‼️ NOTICE: "Cannot use import statement outside a module" in CodeBuild in 1.95.0
See original GitHub issuePlease add your +1 👍 to let us know you have encountered this issue.
Status: IN-PROGRESS
Overview:
In version 1.95.0
of CDK, the CodeBuild module fails to load with an exception:
Cannot use import statement outside a module
Complete Error Message:
/Users/asmajlovic/code/marsconnected-cdk/node_modules/@aws-cdk/aws-codebuild/node_modules/@aws-cdk/yaml-cfn/lib/yaml.ts:1
import * as yaml from 'yaml';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:355:18)
at wrapSafe (node:internal/modules/cjs/loader:1022:15)
at Module._compile (node:internal/modules/cjs/loader:1056:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Object.require.extensions.<computed> [as .ts] (/Users/asmajlovic/code/marsconnected-cdk/node_modules/ts-node/src/index.ts:1045:43)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/Users/asmajlovic/code/marsconnected-cdk/node_modules/@aws-cdk/aws-codebuild/node_modules/@aws-cdk/yaml-cfn/lib/index.ts:1:1)
Workaround:
Roll back to version 1.94.1
.
Solution:
Related Issues:
Original issue
Synth’ing a CDK pipeline fails after upgrading to 1.95.0
Reproduction Steps
Upgrade from 1.94.1 or earlier to 1.95.0
What did you expect to happen?
expected the stack to successfully synth
What actually happened?
C:\Users\graeme\cloudcycle\DataStorage\node_modules@aws-cdk\aws-codebuild\node_modules@aws-cdk\yaml-cfn\lib\yaml.ts:1 import * as yaml from ‘yaml’; ^^^^^^
SyntaxError: Cannot use import statement outside a module at wrapSafe (internal/modules/cjs/loader.js:979:16) at Module._compile (internal/modules/cjs/loader.js:1027:27) at Module._extensions…js (internal/modules/cjs/loader.js:1092:10) at Object.require.extensions.<computed> [as .ts] (C:\Users\graeme\cloudcycle\DataStorage\node_modules\ts-node\src\index.ts:1045:43) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at Object.<anonymous> (C:\Users\graeme\cloudcycle\DataStorage\node_modules@aws-cdk\aws-codebuild\node_modules@aws-cdk\yaml-cfn\lib\index.ts:1:1) at Module._compile (internal/modules/cjs/loader.js:1063:30)
Environment
- **CDK CLI Version :1.95.0
- **Framework Version:1.95.0
- **Node.js Version: v14.15.5
- **OS :Windows 10
- **Language (Version): typescript": "4.2.3
Other
Simple CDKPipline using a GitHubSourceAction
with SimpleSynthAction.standardNpmSynth
No usage of the new BuildSpec.fromObjectToYaml
method added in #13445
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 2 years ago
- Reactions:13
- Comments:7 (5 by maintainers)
Top GitHub Comments
The fix in
1.95.1
has been released, and customers are seeing recovery.Resolving this issue, please comment if you run into it again!
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.