Skip to content

Commit 02cb2dc

Browse files
authored
chore: fix esm scope for layers stack (#4007)
1 parent d3e4184 commit 02cb2dc

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

layers/src/canary-stack.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { randomUUID } from 'node:crypto';
2-
import path from 'node:path';
2+
import { dirname, join } from 'node:path';
3+
import { fileURLToPath } from 'node:url';
34
import { CustomResource, Duration, Stack, type StackProps } from 'aws-cdk-lib';
45
import { Effect, PolicyStatement } from 'aws-cdk-lib/aws-iam';
56
import { LayerVersion, Runtime, Tracing } from 'aws-cdk-lib/aws-lambda';
@@ -15,6 +16,9 @@ export interface CanaryStackProps extends StackProps {
1516
readonly ssmParameterLayerArn: string;
1617
}
1718

19+
const __filename = fileURLToPath(import.meta.url);
20+
const __dirname = dirname(__filename);
21+
1822
export class CanaryStack extends Stack {
1923
public constructor(scope: Construct, id: string, props: CanaryStackProps) {
2024
super(scope, id, props);
@@ -36,7 +40,7 @@ export class CanaryStack extends Stack {
3640
];
3741

3842
const canaryFunction = new NodejsFunction(this, 'CanaryFunction', {
39-
entry: path.join(
43+
entry: join(
4044
__dirname,
4145
'../tests/e2e/layerPublisher.class.test.functionCode.ts'
4246
),

layers/src/layer-publisher-stack.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { execSync } from 'node:child_process';
22
import { randomUUID } from 'node:crypto';
3-
import { join, resolve, sep } from 'node:path';
3+
import { dirname, join, resolve, sep } from 'node:path';
4+
import { fileURLToPath } from 'node:url';
45
import { CfnOutput, RemovalPolicy, Stack, type StackProps } from 'aws-cdk-lib';
56
import {
67
Architecture,
@@ -12,6 +13,9 @@ import {
1213
import { StringParameter } from 'aws-cdk-lib/aws-ssm';
1314
import type { Construct } from 'constructs';
1415

16+
const __filename = fileURLToPath(import.meta.url);
17+
const __dirname = dirname(__filename);
18+
1519
export interface LayerPublisherStackProps extends StackProps {
1620
readonly layerName?: string;
1721
readonly powertoolsPackageVersion?: string;

0 commit comments

Comments
 (0)