aws-delivlib module includes both .ts and .d.ts files, causing failures when ts-node's `--prefer-ts-exts` flag is set
tneely opened this issue · 2 comments
tneely commented
I'm not sure whether this is a bug with aws-delivlib specifically or more an issue with ts-node, but deploying a CDK app using aws-delivlib with npx ts-node --prefer-ts-exts bin/app.ts
returns a Cannot use import statement outside a module
syntax error.
As a workaround, you can just remove the --prefer-ts-exts
flag: npx ts-node bin/app.ts
.
A similar issue came up in the main aws-cdk library a few months back: aws/aws-cdk#13795
Here's the full command output:
$ cdk deploy --app "npx ts-node --prefer-ts-exts src/app.ts" -v
CDK toolkit version: 1.126.0 (build f004e1a)
Command line arguments: {
_: [ 'deploy' ],
app: 'npx ts-node --prefer-ts-exts src/app.ts',
a: 'npx ts-node --prefer-ts-exts src/app.ts',
v: 1,
verbose: 1,
lookups: true,
'ignore-errors': false,
ignoreErrors: false,
json: false,
j: false,
debug: false,
ec2creds: undefined,
i: undefined,
'version-reporting': undefined,
versionReporting: undefined,
'path-metadata': true,
pathMetadata: true,
'asset-metadata': true,
assetMetadata: true,
'role-arn': undefined,
r: undefined,
roleArn: undefined,
staging: true,
'no-color': false,
noColor: false,
all: false,
'build-exclude': [],
E: [],
buildExclude: [],
ci: false,
execute: true,
force: false,
f: false,
parameters: [ {} ],
'previous-parameters': true,
previousParameters: true,
'$0': 'cdk'
}
cdk.json: {
"app": "npx ts-node --prefer-ts-exts src/app.ts",
"context": {
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": "true",
"@aws-cdk/core:enableStackNameDuplicates": "true",
"aws-cdk:enableDiffNoFail": "true",
"@aws-cdk/core:stackRelativeExports": "true",
"@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": "true",
"@aws-cdk/aws-secretsmanager:parseOwnedSecretName": "true",
"@aws-cdk/aws-kms:defaultKeyPolicies": "true",
"@aws-cdk/aws-s3:grantWriteWithoutAcl": "true",
"@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount": "true",
"@aws-cdk/aws-rds:lowercaseDbIdentifier": "true",
"@aws-cdk/aws-efs:defaultEncryptionAtRest": "true",
"@aws-cdk/core:newStyleStackSynthesis": "true"
},
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
}
merged settings: {
versionReporting: true,
pathMetadata: true,
output: 'cdk.out',
app: 'npx ts-node --prefer-ts-exts src/app.ts',
context: {
'@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId': 'true',
'@aws-cdk/core:enableStackNameDuplicates': 'true',
'aws-cdk:enableDiffNoFail': 'true',
'@aws-cdk/core:stackRelativeExports': 'true',
'@aws-cdk/aws-ecr-assets:dockerIgnoreSupport': 'true',
'@aws-cdk/aws-secretsmanager:parseOwnedSecretName': 'true',
'@aws-cdk/aws-kms:defaultKeyPolicies': 'true',
'@aws-cdk/aws-s3:grantWriteWithoutAcl': 'true',
'@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount': 'true',
'@aws-cdk/aws-rds:lowercaseDbIdentifier': 'true',
'@aws-cdk/aws-efs:defaultEncryptionAtRest': 'true',
'@aws-cdk/core:newStyleStackSynthesis': 'true'
},
'//': '~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".',
debug: false,
assetMetadata: true,
toolkitBucket: {},
staging: true,
bundlingStacks: [ '*' ],
lookups: true
}
Determining if we're on an EC2 instance.
Does not look like an EC2 instance.
Toolkit stack: CDKToolkit
Setting "CDK_DEFAULT_REGION" environment variable to us-west-2
Resolving default credentials
Retrieved account ID 123456789012 from disk cache
Setting "CDK_DEFAULT_ACCOUNT" environment variable to 123456789012
context: {
'@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId': 'true',
'@aws-cdk/core:enableStackNameDuplicates': 'true',
'aws-cdk:enableDiffNoFail': 'true',
'@aws-cdk/core:stackRelativeExports': 'true',
'@aws-cdk/aws-ecr-assets:dockerIgnoreSupport': 'true',
'@aws-cdk/aws-secretsmanager:parseOwnedSecretName': 'true',
'@aws-cdk/aws-kms:defaultKeyPolicies': 'true',
'@aws-cdk/aws-s3:grantWriteWithoutAcl': 'true',
'@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount': 'true',
'@aws-cdk/aws-rds:lowercaseDbIdentifier': 'true',
'@aws-cdk/aws-efs:defaultEncryptionAtRest': 'true',
'@aws-cdk/core:newStyleStackSynthesis': 'true',
'aws:cdk:enable-path-metadata': true,
'aws:cdk:enable-asset-metadata': true,
'aws:cdk:version-reporting': true,
'aws:cdk:bundling-stacks': [ '*' ]
}
outdir: cdk.out
env: {
CDK_DEFAULT_REGION: 'us-west-2',
CDK_DEFAULT_ACCOUNT: '123456789012',
CDK_CONTEXT_JSON: '{"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId":"true","@aws-cdk/core:enableStackNameDuplicates":"true","aws-cdk:enableDiffNoFail":"true","@aws-cdk/core:stackRelativeExports":"true","@aws-cdk/aws-ecr-assets:dockerIgnoreSupport":"true","@aws-cdk/aws-secretsmanager:parseOwnedSecretName":"true","@aws-cdk/aws-kms:defaultKeyPolicies":"true","@aws-cdk/aws-s3:grantWriteWithoutAcl":"true","@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount":"true","@aws-cdk/aws-rds:lowercaseDbIdentifier":"true","@aws-cdk/aws-efs:defaultEncryptionAtRest":"true","@aws-cdk/core:newStyleStackSynthesis":"true","aws:cdk:enable-path-metadata":true,"aws:cdk:enable-asset-metadata":true,"aws:cdk:version-reporting":true,"aws:cdk:bundling-stacks":["*"]}',
CDK_OUTDIR: 'cdk.out',
CDK_CLI_ASM_VERSION: '14.0.0',
CDK_CLI_VERSION: '1.126.0'
}
Cannot use import statement outside a module
Subprocess exited with error 1
Error: Subprocess exited with error 1
at ChildProcess.<anonymous> (/Users/tayneely/.nvm/versions/node/v14.18.0/lib/node_modules/cdk/node_modules/aws-cdk/lib/api/cxapp/exec.ts:122:23)
at ChildProcess.emit (events.js:400:28)
at ChildProcess.emit (domain.js:475:12)
at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
github-actions commented
This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.
github-actions commented
Closing this issue as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen.