Skip to content
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

Unexpected token in node_modules/serverless/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js:343 #99

Closed
Celebrate-Reinhard opened this issue Jan 7, 2025 · 4 comments

Comments

@Celebrate-Reinhard
Copy link

Run serverless/github-action@v3
  with:
    args: -c "serverless plugin install --name serverless-domain-manager && serverless deploy --stage stage"
    entrypoint: /bin/sh
  env:
...
/usr/local/lib/node_modules/serverless/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js:343
  static {
         ^

SyntaxError: Unexpected token '{'
    at wrapSafe (internal/modules/cjs/loader.js:1029:16)
    at Module._compile (internal/modules/cjs/loader.js:1078:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/lib/monitoring/monitoring-integration-service.js:10:5)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/lib/plugin.js:26:38)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/index.js:5:18)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/serverless/lib/cli/handle-error.js:6:35)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/serverless/scripts/serverless.js:17:21)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at /usr/local/lib/node_modules/serverless/bin/serverless.js:73:7
@Celebrate-Reinhard Celebrate-Reinhard changed the title Unexpected token Unexpected token in node_modules/serverless/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js:343 Jan 7, 2025
@Celebrate-Reinhard
Copy link
Author

There is already a related issue in aws sdk project: aws/aws-sdk-js-v3#6779

@Adesin-fr
Copy link

Hi,

Has anybody found a workaround for this in the meantime ?

In the aws/aws-sdk-js ticket, it seems to be a nodejs version related problem, which can be (temporary) resolved by setting a newer node version (like 18 or 20)

@Adesin-fr
Copy link

Edit :
Looking at this repo, it seems that serverless/github-action@v3 uses an old version of Node, BUT, serverless/[email protected] uses a more recent version !

I've tried with one of my repo, and it fixes the problem !

@Celebrate-Reinhard
Copy link
Author

serverless/[email protected] uses a more recent version !

I've tried with one of my repo, and it fixes the problem !

Thank you, @Adesin-fr !

I can confirm that serverless/[email protected] does the job.

As we're using dependabot which always wanted to update to v4, we missed those minor versions.

To not oversee new minor versions again, I updated dependabot.yml like this:

...
  - package-ecosystem: "github-actions"
    target-branch: "main"
    directory: "/" # default location of .github/workflows
    schedule:
      interval: "daily"
    ignore:
      - dependency-name: "serverless/github-action"
        update-types: ["version-update:semver-major"]
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants