I have a NodeJS server that used the AWS SDK v2. I started seeing these messages:
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
I ran the suggested command npx aws-sdk-js-codemod --dry --print -t v2-to-v3 routes/users.js
, some lines get changed, but the code hangs due to a .promise()
that the codemod missed.
I read the documentation and tried this code, copied straight from the documentation:
const {sns, sns_add_permission_command} = require("@aws-sdk/client-sns");
const sns_client = new sns({
region: "eu-west-1",
apiVersion: '2010-03-31'
});
And I get this error:
const sns_client = new sns({
^
TypeError: sns is not a constructor
What am I doing wrong?
SNSClient
.