auto-tag
auto-tag copied to clipboard
run time error in latest release; npm test failures
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
> [email protected] 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.
Installed this today with "latest" and getting the same error. Cannot use import statement outside a module
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.
Thank you @gtoonstra - running update-master fixed it for me too :-)
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.