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

run time error in latest release; npm test failures #126

Open
robertwilkinson9 opened this issue Feb 1, 2024 · 4 comments
Open

run time error in latest release; npm test failures #126

robertwilkinson9 opened this issue Feb 1, 2024 · 4 comments

Comments

@robertwilkinson9
Copy link

consistent run time error:

2024-02-01T08:07:58.272Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Runtime.UserCodeSyntaxError","errorMessage":"SyntaxError: Cannot use import statement outside a module","stack":["Runtime.UserCodeSyntaxError: SyntaxError: Cannot use import statement outside a module","    at _loadUserApp (file:///var/runtime/index.mjs:1084:17)","    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)","    at async start (file:///var/runtime/index.mjs:1282:23)","    at async file:///var/runtime/index.mjs:1288:1"]}

npm test errors:

[cloudshell-user@ip-10-134-44-138 auto-tag]$ npm run test

> autotag@1.0.0 test
> babel-node --config-file ./babelrc-node ./node_modules/.bin/jasmine --random=false

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/cloudshell-user/src/auto-tag/spec/autotag_spec.js from /home/cloudshell-user/src/auto-tag/node_modules/jasmine/lib/loader.js not supported.
Instead change the require of autotag_spec.js in /home/cloudshell-user/src/auto-tag/node_modules/jasmine/lib/loader.js to a dynamic import() which is available in all CommonJS modules.
    at Object.newLoader [as .js] (/home/cloudshell-user/src/auto-tag/node_modules/pirates/lib/index.js:121:7)
    at Loader.requireShim [as require_] (/home/cloudshell-user/src/auto-tag/node_modules/jasmine/lib/loader.js:26:3)
    at /home/cloudshell-user/src/auto-tag/node_modules/jasmine/lib/loader.js:19:12
    at new Promise (<anonymous>)
    at Loader.load (/home/cloudshell-user/src/auto-tag/node_modules/jasmine/lib/loader.js:18:12)
    at Jasmine._loadFiles (/home/cloudshell-user/src/auto-tag/node_modules/jasmine/lib/jasmine.js:210:23)
    at Jasmine.loadSpecs (/home/cloudshell-user/src/auto-tag/node_modules/jasmine/lib/jasmine.js:201:14)
    at Jasmine.execute (/home/cloudshell-user/src/auto-tag/node_modules/jasmine/lib/jasmine.js:584:14) {
  code: 'ERR_REQUIRE_ESM'
}
[cloudshell-user@ip-10-134-44-138 auto-tag]$ 

Unsure if they are related.

@gtoonstra
Copy link

Installed this today with "latest" and getting the same error. Cannot use import statement outside a module

@gtoonstra
Copy link

Installed this today with "latest" and getting the same error. Cannot use import statement outside a module

In my case I rebuilt using local v18.19.0 runtime and when run using update-master, the tagging started to work.

@robertwilkinson9
Copy link
Author

Thank you @gtoonstra - running update-master fixed it for me too :-)

@robertwilkinson9
Copy link
Author

robertwilkinson9 commented Feb 6, 2024

When I say fixed, I meant that the code correctly tagged a new EC2 instance.

I tested the creation of an S3 bucket, which failed with

"responsePayload":{"errorType":"InvalidTag","errorMessage":"The TagValue you have provided is invalid"

I did not specify any additional tags apart from the --custom-tags I supplied when I deployed the code. (The custom tag appears correctly in the EC2 invocation).

Anecdotally I saw the correct tagging of a network interface when a vpc was attached to it, and log groups which already exist are not handled correctly.

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