20

I am seeing an awful lot of this message:

NOTE: The AWS SDK for JavaScript (v2) will be put 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)

Is it possible to suppress it?

(It's not my code base, so out of my control to upgrade to v3).

TylerH
  • 20,799
  • 66
  • 75
  • 101
Steve Bennett
  • 114,604
  • 39
  • 168
  • 219

4 Answers4

15

The best way to suppress this warning (as documented by AWS) is to use an environment variable like so:

process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE = '1';

OR

AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE=1 node my_program.js

Source: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/

Anjul Garg
  • 484
  • 1
  • 4
  • 17
10

I grepped the AWS SDK code and this seems to work. I feel something like this should documented as a part of the warning message.

require('aws-sdk/lib/maintenance_mode_message').suppress = true;
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
2

Pinning the SDK version to 2.1311.0 removes the deprecation warning.

Credit: https://github.com/serverless/serverless/issues/11753#issuecomment-1433733188

jarora
  • 5,384
  • 2
  • 34
  • 46
0

Simply Just import aws-sdk like this

const AWS = require("aws-sdk");
require("aws-sdk/lib/maintenance_mode_message").suppress = true;

https://github.com/aws/aws-sdk-js/commit/720bc9ff1bf3be5c4478365fef1fc98be70a5d76

can see change they have made here