Describe the bug
When using Canary with custom test code asset in Stage, CDK fails to synthesize.
Expected Behavior
Successfully synthesized with code asset.
Current Behavior
Fail to synshesize with error:
Error: ENOENT: no such file or directory, lstat 'asset.1e64e462d93160eb5230b00e665705bfaf2299d9c302ab56dd093bccbe387c4f'
at Object.lstatSync (node:fs:1668:3)
at AssetCode.validateCanaryAsset (/path/to/project/node_modules/@aws-cdk/aws-synthetics-alpha/lib/code.ts:139:15)
at AssetCode.bind (/path/to/project/node_modules/@aws-cdk/aws-synthetics-alpha/lib/code.ts:109:10)
at Canary.createCode (/path/to/project/node_modules/@aws-cdk/aws-synthetics-alpha/lib/canary.ts:492:26)
at new Canary (/path/to/project/node_modules/@aws-cdk/aws-synthetics-alpha/lib/canary.ts:319:18)
at Object.<anonymous> (/path/to/project/bin/quick/canary-alpha.ts:24:1)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module.m._compile (/path/to/project/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.require.extensions.<computed> [as .ts] (/path/to/project/node_modules/ts-node/src/index.ts:1621:12) {
errno: -2,
syscall: 'lstat',
code: 'ENOENT',
path: 'asset.1e64e462d93160eb5230b00e665705bfaf2299d9c302ab56dd093bccbe387c4f'
}
Subprocess exited with error 1
Reproduction Steps
1/ Make sure successfully synthesized Canary without Stage
import 'source-map-support/register';
import { App, Duration, RemovalPolicy, Stack, Stage } from 'aws-cdk-lib';
import * as synthetics from '@aws-cdk/aws-synthetics-alpha';
import { Bucket } from 'aws-cdk-lib/aws-s3';
const app = new App();
const stack = new Stack(app, 'CanryAlpha', {
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: 'us-west-2',
},
});
const canaryBucket = new Bucket(stack, 'CanaryBucket', {
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});
new synthetics.Canary(stack, 'Canary', {
schedule: synthetics.Schedule.rate(Duration.minutes(1)),
test: synthetics.Test.custom({
code: synthetics.Code.fromAsset('lambda/canary-app'),
handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_5,
environmentVariables: {
TARGETHOST: 'https://example.com',
TARGETPATH: '/',
},
artifactsBucketLocation: { bucket: canaryBucket },
});
2/ Add Stage and make the Stack belong to it
+const stage = new Stage(app, 'Dev');
+const stack = new Stack(stage, 'CanryAlpha', {
-const stack = new Stack(app, 'CanryAlpha', {
Full code
import 'source-map-support/register';
import { App, Duration, RemovalPolicy, Stack, Stage } from 'aws-cdk-lib';
import * as synthetics from '@aws-cdk/aws-synthetics-alpha';
import { Bucket } from 'aws-cdk-lib/aws-s3';
const app = new App();
const stage = new Stage(app, 'Dev');
const stack = new Stack(stage, 'CanryAlpha', {
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: 'us-west-2',
},
});
const canaryBucket = new Bucket(stack, 'CanaryBucket', {
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});
new synthetics.Canary(stack, 'Canary', {
schedule: synthetics.Schedule.rate(Duration.minutes(1)),
test: synthetics.Test.custom({
code: synthetics.Code.fromAsset('lambda/canary-app'),
handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_5,
environmentVariables: {
TARGETHOST: 'https://example.com',
TARGETPATH: '/',
},
artifactsBucketLocation: { bucket: canaryBucket },
});
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.94.0 (build 987c329)
Framework Version
No response
Node.js Version
v18.17.1
OS
macOS Ventura 13.5.2(22G91)
Language
Typescript
Language Version
TypeScript 5.2.2
Other information
No response
Describe the bug
When using
Canarywith custom test code asset in Stage, CDK fails to synthesize.Expected Behavior
Successfully synthesized with code asset.
Current Behavior
Fail to synshesize with error:
Reproduction Steps
1/ Make sure successfully synthesized Canary without Stage
2/ Add Stage and make the Stack belong to it
Full code
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.94.0 (build 987c329)
Framework Version
No response
Node.js Version
v18.17.1
OS
macOS Ventura 13.5.2(22G91)
Language
Typescript
Language Version
TypeScript 5.2.2
Other information
No response