aws / aws-sdk-js

AWS SDK for JavaScript in the browser and Node.js
https://aws.amazon.com/developer/language/javascript/
Apache License 2.0
7.59k stars 1.55k forks source link

S3Client crash #4524

Closed lerdsuwa closed 10 months ago

lerdsuwa commented 10 months ago

Describe the bug

Running Elastic Beanstalk pipeline today, my node.js application fails with the following error. It didn't happen a few days before. The "?." is syntax error for cjs.

/var/app/current/node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js:33 const _config_10 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_9, configuration?.extensions || []); ^

SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) 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. (/var/app/current/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:5:22) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

Expected Behavior

Module should be imported without error

Current Behavior

Node.js application clashes when importing s3 client. The file node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js contains invalid code

Reproduction Steps

Use npm to install latest aws-sdk.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

2.1490.0

Environment details (OS name and version, etc.)

Node.js running on 64bit Amazon Linux/4.17.13

lerdsuwa commented 10 months ago

I try "npm install" on another project that uses AWS SDK v3 and it has the same exact file node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js with the same error

abadiwidodo commented 10 months ago

Got the same error

lerdsuwa commented 10 months ago

It turned out that Node.js version 14.0+ supports the syntax but elasticbeanstalk platform is using version 12. So closing it.