-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error when serverless uses aws-sdk/client-cloudformation #6779
Comments
When this will be resolved. |
Happening the same for me. ubuntu-22.04 |
same for me |
1 similar comment
same for me |
Happening here, as well. Seeing it in an AWS Codebuild "aws/codebuild/amazonlinux2-x86_64-standard:4.0" environment, using serverless version 3.35.2 |
2025/01/07 17:55:29.302923 Running command serverless deploy --config ${ServerlessFileName} --stage ${Environment}
--
233 | /usr/local/lib/node_modules/serverless/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js:343
234 | static {
235 | ^
236 |
237 | SyntaxError: Unexpected token '{'
238 | at wrapSafe (internal/modules/cjs/loader.js:1029:16)
239 | at Module._compile (internal/modules/cjs/loader.js:1078:27)
240 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
241 | at Module.load (internal/modules/cjs/loader.js:979:32)
242 | at Function.Module._load (internal/modules/cjs/loader.js:819:12)
243 | at Module.require (internal/modules/cjs/loader.js:1003:19)
244 | at require (internal/modules/cjs/helpers.js:107:18)
245 | at Object.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/lib/monitoring/monitoring-integration-service.js:10:5)
246 | at Module._compile (internal/modules/cjs/loader.js:1114:14)
247 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
248 | at Module.load (internal/modules/cjs/loader.js:979:32)
249 | at Function.Module._load (internal/modules/cjs/loader.js:819:12)
250 | at Module.require (internal/modules/cjs/loader.js:1003:19)
251 | at require (internal/modules/cjs/helpers.js:107:18)
252 | at Object.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/lib/plugin.js:26:38)
253 | at Module._compile (internal/modules/cjs/loader.js:1114:14)
254 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
255 | at Module.load (internal/modules/cjs/loader.js:979:32)
256 | at Function.Module._load (internal/modules/cjs/loader.js:819:12)
257 | at Module.require (internal/modules/cjs/loader.js:1003:19)
258 | at require (internal/modules/cjs/helpers.js:107:18)
259 | at Object.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/index.js:5:18)
260 | at Module._compile (internal/modules/cjs/loader.js:1114:14)
261 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
262 | at Module.load (internal/modules/cjs/loader.js:979:32)
263 | at Function.Module._load (internal/modules/cjs/loader.js:819:12)
264 | at Module.require (internal/modules/cjs/loader.js:1003:19)
265 | at require (internal/modules/cjs/helpers.js:107:18)
266 | at Object.<anonymous> (/usr/local/lib/node_modules/serverless/lib/cli/handle-error.js:6:35)
267 | at Module._compile (internal/modules/cjs/loader.js:1114:14)
268 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
269 | at Module.load (internal/modules/cjs/loader.js:979:32)
270 | at Function.Module._load (internal/modules/cjs/loader.js:819:12)
271 | at Module.require (internal/modules/cjs/loader.js:1003:19)
272 | at require (internal/modules/cjs/helpers.js:107:18)
273 | at Object.<anonymous> (/usr/local/lib/node_modules/serverless/scripts/serverless.js:17:21)
274 | at Module._compile (internal/modules/cjs/loader.js:1114:14)
275 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
276 | at Module.load (internal/modules/cjs/loader.js:979:32)
277 | at Function.Module._load (internal/modules/cjs/loader.js:819:12)
278 | at Module.require (internal/modules/cjs/loader.js:1003:19)
279 | at require (internal/modules/cjs/helpers.js:107:18)
280 | at /usr/local/lib/node_modules/serverless/bin/serverless.js:73:7 |
The syntax is a static initialization block that was introduced in Node.js 16.11.0, according to This SDK recently updated to require Node.js 18 and higher announced in #6252. The EOL date of Node.js 16 was in September 2023. Is the execution environment using a lower Node.js version? |
While we're looking into it, could someone share minimal reproducible code along with your Github action? |
For a temporary working solution, explicitly add the working versions of the following packages to the Here is my list, but you can simply add
|
@jperocho this doesn't work because serverless is the one that makes use of @aws-sdk/client-cloudformation": "3.714.0 not my project itself, so adding it to my project's package.json doesn't really do anything, serverless overrides it. |
this is the github action used, the failure happens on the serverless deploy section, and you can probably use any boilerplate serverless.yml file |
@mlopez34 thanks for sharing the GitHub action used. Minimal Repro with cloudformationname: Create CloudFormation Stack
on:
workflow_dispatch:
jobs:
create-stack:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['>=16.11.0', '18.20.5', '20.18.1', '<16.11.0']
steps:
- name: Print version details
run: |
echo "Ubuntu version:"
lsb_release -a
echo "-----------------"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Print Node.js version
run: node --version
- name: Print npm version
run: npm --version
- name: Print AWS SDK version
run: |
npm install @aws-sdk/client-cloudformation
node -e 'console.log(require("@aws-sdk/client-cloudformation/package.json").version)'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Create CloudFormation Stack
run: |
npm install @aws-sdk/client-cloudformation
node -e 'require("@aws-sdk/client-cloudformation")'
NODE_VERSION="${{ matrix.node-version }}"
STACK_NAME="my-stack-node-$(echo "$NODE_VERSION" | sed 's/[^a-zA-Z0-9-]/-/g' | sed 's/^-//' | sed 's/-$//')"
aws cloudformation create-stack \
--stack-name "$STACK_NAME" \
--template-body '{"Resources": {"MyBucket": {"Type": "AWS::S3::Bucket", "Properties": {"BucketName": "sdk-node-repro"}}}}' \
--capabilities CAPABILITY_NAMED_IAM
env:
AWS_REGION: us-west-2 The workflow installs the Test Case ScenariosCase 1
Case 2
Case 3
The finding is that the reported error is reproducible only with <16.11.0 or v16.10.0. The rest of the Node.js versions completed the workflow run successfully. Another finding since you mentioned the failure happens on serverless deploy section is that I didn't have serverless in my minimal repro. |
tried using node 20.x on the github workflow, it uses node v20.18.1 |
same here, im using @datadog/datadog-ci as dependency. |
As a temporary solution, We locked down our serverless framework version in jenkins to 3.25. |
we're using node.js 14 and 3.38 - is this going to work again? |
As pointed out here by Adesin-fr |
This works now by using serverless/[email protected] thanks |
@Celebrate-Reinhard @mlopez34 - thanks for sharing your finding and the solution here. For everyone else, the root cause to this issue appears to be From linked issue above:
Since the root cause isn't SDK related issue, we'll be closing this soon. Let us know if issue persists with suggested solution. |
We are also using the same and the error persists. |
we changed our deployment to use node.js 18 and serverless framework 3.38.0 - using different images in AWS that have that version of node.js installed and all works again |
standard 7 image for codedeploy in AWS works |
Checkboxes for prior research
Describe the bug
have recently gotten this error:
When using serverless to deploy to AWS using github actions
9 hours ago from this post github action successfully deployed, i noticed first failure 4 hours ago and all since then.
noticed that the latest update for client-cloudformation on npm was 7 hours ago so it is most likely this latest update.
currently using the following on github actions:
Have not tested upgrading to Node v20, but that is probably not the solution since I ran locally successfully, and i have node v18.20.2, serverless 3.38.0, npm 10.9.1
Can provide more info if needed
Thanks
Regression Issue
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
Node v 18.20.5 [email protected] npm: 10.8.2
Reproduction Steps
Ubuntu v 24.04.1
Node v 18.20.5
[email protected]
npm: 10.8.2
Observed Behavior
on github actions, when deploying using serverless which uses this package @aws-sdk/client-cloudformation, the deployment fails since latest update
Expected Behavior
successful deployment
Possible Solution
No response
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: