You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use aws-sdk/client-sns to trigger email alerts for updates in our web application. Today we began getting an error from the node_modules when the package was upgraded during a deployment. We believe the new package version that broke our app was "version": "3.160.0" according to our package-lock.json. We also tried using the most updated package version @3.202.0 but got the same error.
Our app runs Kubernetes on EKS and our AWS credentials are set automatically so we don't think that was the problem.
Pinning the @aws-sdk/client-sns package to "3.43.0" removed the error and our app began working again after re-deployment. However we are stuck with the old version.
SDK version number
@aws-sdk/client-sns/@3.202.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
12
Reproduction Steps
import{SNSClient,PublishCommand}from'@aws-sdk/client-sns';exportdefault{initialize(app){if(!this.s3){this.s3=newaws.S3();debug('Connected to Amazon S3.');}if(!this.sns){this.sns=newSNSClient({region: 'us-east-1'});// we think this is where the bug startsdebug('Connected to Amazon SNS.');}}}
Observed Behavior
When we deployed the app, we encountered this breaking error. It seems like invalid Javascript was created. A "?" character was added to the key "AWSAccountId" somehow.
(node:35) UnhandledPromiseRejectionWarning: /var/node/atlas/node_modules/@aws-sdk/client-sns/dist-cjs/protocols/Aws_query.js:2801
if (input.AWSAccountId?.length === 0) {
^
SyntaxError: Unexpected token '.'
at compileFunction (<anonymous>)
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Object.require.extensions.<computed> [as .js] (/var/node/atlas/node_modules/babel-register/lib/node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/var/node/atlas/node_modules/@aws-sdk/client-sns/dist-cjs/commands/AddPermissionCommand.js:8:21)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Object.require.extensions.<computed> [as .js] (/var/node/atlas/node_modules/babel-register/lib/node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
(node:35) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:35) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
### Expected Behavior
We expected the ```new SNSClient({ region: 'us-east-1' });``` function to work with the most updated @aws-sdk/client-sns package.
### Possible Solution
We pinned the @aws-sdk/client-sns package version to "3.43.0" for now and it currently has no problems with our stack. However that means we are stuck with the old package version.
### Additional Information/Context
_No response_
The text was updated successfully, but these errors were encountered:
When we deployed the app, we encountered this breaking error. It seems like invalid Javascript was created. A "?" character was added to the key "AWSAccountId" somehow.
Hi @wangytangy, thanks for opening this issue. The character "?" is a feature known as optional chaining in JS, and it just prevent an error about reading a property from an undefined element, for example if "input.AWSAccountId" is undefined or null then instead of an error, undefined will be returned. So, the reason why you may be getting this error is because optional chaining is not supported by node 13 and below, so that you should consider to use node 14 and above in order to have this error gone, and also node 12 is not longer supported by the AWS SDK for JavaScript. Information can be found here.
Thanks!
yenfryherrerafeliz
added
closing-soon
This issue will automatically close in 4 days unless further comments are made.
p2
This is a standard priority issue
and removed
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
p1
This is a high priority issue
labels
Nov 4, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Checkboxes for prior research
Describe the bug
We use aws-sdk/client-sns to trigger email alerts for updates in our web application. Today we began getting an error from the node_modules when the package was upgraded during a deployment. We believe the new package version that broke our app was "version": "3.160.0" according to our package-lock.json. We also tried using the most updated package version @3.202.0 but got the same error.
Our app runs Kubernetes on EKS and our AWS credentials are set automatically so we don't think that was the problem.
Pinning the @aws-sdk/client-sns package to "3.43.0" removed the error and our app began working again after re-deployment. However we are stuck with the old version.
SDK version number
@aws-sdk/client-sns/@3.202.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
12
Reproduction Steps
Observed Behavior
When we deployed the app, we encountered this breaking error. It seems like invalid Javascript was created. A "?" character was added to the key "AWSAccountId" somehow.
The text was updated successfully, but these errors were encountered: