Closed konokenj closed 1 year ago
A few minor questions:
path.join(__dirname__, 'lambda/canary-app')
for the asset path help?@indrora Thank you for responding.
Have you packaged your canary as is described in the documentation?
Yes. It can be synthesized successfully with same code in aws-synthetics-alpha:2.38.1-alpha.0
. This issue occured in upgrading it to 2.95.1-alpha.0
.
Does using
path.join(__dirname__, 'lambda/canary-app')
for the asset path help?
Same error occurs with using it. Without Stage, synthesized successfully.
code: synthetics.Code.fromAsset(path.join(__dirname, '../../lambda/canary-app')),
Also, I think other assets are able to synthesize without path.join
.
I was able to reproduce this. Curious behavior. Hopefully I can find a fix soon, but thanks for reporting.
Also, I think other assets are able to synthesize without path.join.
path.join
is just the best practice for specifying file paths in code. It should have no bearing on whether or not your app synthesizes, but makes running your app deterministic.
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.
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:
Reproduction Steps
1/ Make sure successfully synthesized Canary without Stage
2/ Add Stage and make the Stack belong to it
Full code
```typescript 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