Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(core): Ability to turn off specific deprecations #24512

Open
2 tasks
moltar opened this issue Mar 8, 2023 · 6 comments
Open
2 tasks

(core): Ability to turn off specific deprecations #24512

moltar opened this issue Mar 8, 2023 · 6 comments
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@moltar
Copy link
Contributor

moltar commented Mar 8, 2023

Describe the feature

I'd like to be able to turn off (ack) some deprecation notices, but keep others.

Use Case

Turn off DnsValidatedCertificate notice.

We know the issue, but there is currently no good solution or path forward. The feature was deprecated without a matching replacement.

This warning shows up everywhere in our workflows and is very annoying. It can also cause warning blindness eventually, as developers learn to ignore it, but can also ignore others.

I want to be able to turn off this specific deprecation.

Proposed Solution

N/A

Other Information

    console.warn
Warning: RNING] aws-cdk-lib.aws_certificatemanager.DnsValidatedCertificate is deprecated.
        use {@link Certificate} instead
        This API will be removed in the next major release.

      119 |      * @see https://github.com/aws/aws-cdk/pull/21982
      120 |      */
    > 121 |     const certificate = new aws_certificatemanager.DnsValidatedCertificate(this, 'ACMCertificate', {
          |                         ^
      122 |       domainName: properties.hostedZone.zoneName,
      123 |       hostedZone: properties.hostedZone,
      124 |       /**

      at Object.print (node_modules/aws-cdk-lib/.warnings.jsii.js:3:146)
      at new DnsValidatedCertificate (node_modules/aws-cdk-lib/aws-certificatemanager/lib/dns-validated-certificate.js:1:639)

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

latest

Environment details (OS name and version, etc.)

macOS

@moltar moltar added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 8, 2023
@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label Mar 8, 2023
@pahud
Copy link
Contributor

pahud commented Mar 8, 2023

Yes this makes sense.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Mar 8, 2023
@moltar
Copy link
Contributor Author

moltar commented Jun 12, 2023

Another source of annoyance is aws-cdk-lib.aws_ec2.MachineImage#latestAmazonLinux.

[WARNING] aws-cdk-lib.aws_ec2.MachineImage#latestAmazonLinux is deprecated.
  use MachineImage.latestAmazonLinux2 instead
  This API will be removed in the next major release.

And this warning is coming from the CDK's own BastionHost construct, which is not upgraded due to the breaking nature of the change (#25310).

@LeoLapworthKT

This comment was marked as off-topic.

@LeoLapworthKT

This comment was marked as off-topic.

@moltar

This comment was marked as outdated.

@metametadata
Copy link

Workaround in Clojure/Java is to manually filter System/err:

(ns ...
  (:import [java.io PrintStream]
           [java.nio.charset StandardCharsets]))

; HACK: suppress "[WARNING] aws-cdk-lib.aws_certificatemanager.DnsValidatedCertificate is deprecated" log.
; The log originates from System.err.write call in software.amazon.jsii.JsiiRuntime.ErrorStreamSink.
; https://github.com/aws/aws-cdk/issues/25343, https://github.com/aws/aws-cdk/issues/24512.
(System/setErr
  (proxy [PrintStream] [System/err]
    (write
      ([x]
       (proxy-super write x))
      ([^bytes buf off len]
       (let [s (String. buf StandardCharsets/UTF_8)]
         (when (not (str/includes? s "DnsValidatedCertificate is deprecated"))
           (proxy-super write buf off len)))))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

4 participants