aws-sdk-js icon indicating copy to clipboard operation
aws-sdk-js copied to clipboard

Please remove annoying migrate to v3 warning or provide a non-invasive way to suppress it

Open et304383 opened this issue 2 years ago • 26 comments
trafficstars

Describe the feature

Ability to suppress the warning message:

Please migrate your code to use AWS SDK for JavaScript (v3). For more information, check the migration guide at https://a.co/7PzMCcy (Use node --trace-warnings ... to show where the warning was created) (node:48756) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.

Use Case

It's incredibly annoying having this spam my console every time I run serverless.

Proposed Solution

An environment variable that can be set to hide this message.

Other Information

No response

Acknowledgements

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

SDK version used

2

Environment details (OS name and version, etc.)

All OS

et304383 avatar Feb 27 '23 16:02 et304383

Ideally, this noisy log should be removed. It's not how deprecations are announced in the Node.js ecosystem. Simply deprecate SDK on npm instead

medikoo avatar Feb 27 '23 19:02 medikoo

https://github.com/aws/aws-sdk-js/blob/c44ef6f16d51965a1e4dd10981d0cbcd7c5f9078/lib/maintenance_mode_message.js#L11-L15

Per this, the following should work:

require('aws-sdk/lib/maintenance_mode_message').suppress = true;

This should be documented somewhere more visible than the source code.

nwalters512 avatar Mar 01 '23 18:03 nwalters512

@nwalters512 this does not help when you're using a third party system like serverless and you don't have any custom JS code you can run.

This warning message is incredibly annoying and should actually be removed as pointed out by @medikoo .

et304383 avatar Mar 01 '23 18:03 et304383

I'm in agreement with you. You specifically asked for a way to suppress the warning message; one already exists.

nwalters512 avatar Mar 01 '23 18:03 nwalters512

Another reason to remove this warning entirely: the v3 SDK isn't even feature-complete (see https://github.com/aws/aws-sdk-js-v3/issues/4004), so I literally can't move to it, no matter how much I want to.

nwalters512 avatar Mar 01 '23 18:03 nwalters512

I've noticed that aws-sdk/lib/maintenance_mode_message is also not reflected in the TypeScript types, which means we have to jump through more hoops in our TypeScript project to disable this warning.

nwalters512 avatar Mar 03 '23 00:03 nwalters512

Another vote to just remove this, it is super annoying and when using it across multiple lambdas you need to suppress this over and over. For now I just patched it out with pnpm.

[email protected]

diff --git a/lib/maintenance_mode_message.js b/lib/maintenance_mode_message.js
index 88efd18e3ea9fb1de65642f99b451b5e553eb20c..19d02e3f276723b1a15742cb116d0da4b1955fd8 100644
--- a/lib/maintenance_mode_message.js
+++ b/lib/maintenance_mode_message.js
@@ -23,9 +23,3 @@ function emitWarning() {
     });
   }
 }
-
-setTimeout(function () {
-  if (!module.exports.suppress) {
-    emitWarning();
-  }
-}, 0);

aphex avatar Mar 03 '23 03:03 aphex

Please be so kind and remove it, adopt a proper way to announce the change, and please do it only when actually ready to be implemented. Appreciate the team's efforts nonetheless 🙏

aragalie avatar Mar 03 '23 06:03 aragalie

Hi people, the intention of this warning is to let you all know about our plans regarding the AWS SDK for JavaScript V2, however, I agree with all of you about that printing this warning, in every console operation we do with the SDK, is not the best experience. I will discuss about this with the team to discuss about possible alternatives.

I will get back to you people as soon as possible.

Thanks!

yenfryherrerafeliz avatar Mar 03 '23 08:03 yenfryherrerafeliz

Thank you for looking into it! I'd be pleased as well if this warning was removed.

aisflat439 avatar Mar 03 '23 12:03 aisflat439

Serverless will suppress the message in a new version, according to this: https://github.com/serverless/serverless/pull/11769.

For other direct users of the aws-sdk package in Node.js, use the following to suppress the message:

require('aws-sdk/lib/maintenance_mode_message').suppress = true;

I will see if we can add an environment variable for suppression as well.

kuhe avatar Mar 03 '23 19:03 kuhe

https://github.com/aws/aws-sdk-js/pull/4357

kuhe avatar Mar 03 '23 20:03 kuhe

Thanks @kuhe.

et304383 avatar Mar 03 '23 20:03 et304383

@yenfryherrerafeliz the message itself isn't the problem, it's not just saying you have 'plans', it's instructing the developer to do something that's unfeasible. V3 is not ready to move to yet otherwise we'd all have heeded the warning. It's was a premature move, and I'm STILL waiting on https://github.com/aws/aws-sdk-js-v3/issues/4004 which was raised last September.

jpike88 avatar Mar 08 '23 07:03 jpike88

In the next release (expected later today), there will be 3 ways to suppress this message.

in https://github.com/aws/aws-sdk-js/blob/master/lib/maintenance_mode_message.js

  1. JS code for suppression
require('aws-sdk/lib/maintenance_mode_message').suppress = true;
  1. detection of the AWS Lambda environment (via env AWS_EXECUTION_ENV=AWS_Lambda_...)
  2. detection of a specific env var AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE=1

kuhe avatar Mar 13 '23 17:03 kuhe

Serverless users- make sure to use serverless ^3.28.1 https://github.com/serverless/serverless/releases/tag/v3.28.1

itskemo avatar Mar 15 '23 10:03 itskemo

I still get the warning after updating to serverless 3.28.1

amyfang3 avatar Mar 24 '23 23:03 amyfang3

Hello everyone, I have encountered the same error. Is it necessary to migrate to v3?? Thanks for your help

zakdaff avatar Apr 05 '23 06:04 zakdaff

The v3 is still in preview . From https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/preview/, it says "This AWS SDK API Reference for JavaScript v3 is in preview" . Am I missing something? Why are we getting this warning asking us to move to a beta library ?

edit: this comment is wrong. Apparently, it is the docs that are in preview and not the library itself.

gramakri avatar May 11 '23 20:05 gramakri

@gramakri This is a preview of the new API reference, as opposed to the old API reference. aws-sdk-js-v3 has been generally available since 2020.

cj-christoph-gysin avatar May 12 '23 06:05 cj-christoph-gysin

@cj-christoph-gysin Thanks for the clarification!

gramakri avatar May 12 '23 06:05 gramakri

` "@aws-sdk/client-ec2": "^3.353.0",

"@aws-sdk/client-s3": "^3.353.0",

"@aws-sdk/client-secrets-manager": "3.353.0",

"@aws-sdk/lib-storage": "^3.353.0",

"@aws-sdk/node-http-handler": "^3.350.0",

"@aws-sdk/s3-request-presigner": "^3.353.0",

"@aws-sdk/types": "^3.347.0",`

I am using these modules, latest and upgraded but still getting that warning message while starting the server, any specific reason?

NanditShah avatar Jun 21 '23 11:06 NanditShah

@NanditShah does setting an ENV AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE=1 work for you?

davit-b avatar Aug 03 '23 21:08 davit-b

I put ENV AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE=1 on all my API & SQS lambdas but it still doesn't suppress the error message.

ERROR	(node:8) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)

aagranovExtend avatar Aug 17 '23 19:08 aagranovExtend

AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE=1 only worked for me in CLI mode, at least calling jest now suppress the message:

package.json "test": "AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE=1 jest --maxWorkers=50% --silent",

dfop02 avatar Aug 22 '23 19:08 dfop02

I am on node v14.19.3 (I know ...) I just "npm install aws-sdk" for a new project I am starting on.

And I get this warning. Why is the default install of this package deprecated?

$ grep aws-sdk package.json 
    "aws-sdk": "^2.1450.0",

$ grep version node_modules/aws-sdk/package.json 
  "version": "2.1450.0"

peebles avatar Sep 03 '23 19:09 peebles

Another reason to remove this warning entirely: the v3 SDK isn't even feature-complete (see aws/aws-sdk-js-v3#4004), so I literally can't move to it, no matter how much I want to.

further, dynamodb-local doesn't work with v3.

shellscape avatar Mar 19 '24 14:03 shellscape

Hello, we will be initiating end of support for JS v2 this September. Since we've added a way to suppress this warning in v2, I will be closing this issue.

kellertk avatar Apr 23 '24 21:04 kellertk