Skip to content

Commit ec1fb9f

Browse files
committed
try this
1 parent cfba9c9 commit ec1fb9f

File tree

2 files changed

+22
-27
lines changed

2 files changed

+22
-27
lines changed

dev-packages/e2e-tests/test-applications/aws-serverless/src/stack.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const LAMBDA_FUNCTIONS_WITH_NPM_DIR = './src/lambda-functions-npm';
1313
const LAMBDA_FUNCTION_TIMEOUT = 10;
1414
const LAYER_DIR = './node_modules/@sentry/aws-serverless/';
1515
export const SAM_PORT = 3001;
16-
const NODE_RUNTIME = `nodejs${process.version.split('.').at(0)?.replace('v', '')}.x`;
1716

1817
export class LocalLambdaStack extends Stack {
1918
sentryLayer: CfnResource;
@@ -80,7 +79,7 @@ export class LocalLambdaStack extends Stack {
8079
properties: {
8180
CodeUri: path.join(functionsDir, lambdaDir),
8281
Handler: 'index.handler',
83-
Runtime: NODE_RUNTIME,
82+
Runtime: `nodejs${process.env.NODE_VERSION ?? '22'}.x`,
8483
Timeout: LAMBDA_FUNCTION_TIMEOUT,
8584
Layers: addLayer ? [{ Ref: this.sentryLayer.logicalId }] : undefined,
8685
Environment: {

dev-packages/e2e-tests/test-applications/aws-serverless/tests/lambda-fixtures.ts

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
1616
async ({}, use) => {
1717
console.log('[testEnvironment fixture] Setting up AWS Lambda test infrastructure');
1818

19-
console.log('NODE_VERSION', process.env.NODE_VERSION);
20-
2119
execSync('docker network prune -f');
2220
execSync(`docker network create --driver bridge ${DOCKER_NETWORK_NAME}`);
2321

@@ -31,25 +29,23 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
3129
const debugLog = tmp.fileSync({ prefix: 'sentry_aws_lambda_tests_sam_debug', postfix: '.log' });
3230
console.log(`[test_environment fixture] Writing SAM debug log to: ${debugLog.name}`);
3331

34-
const args = [
35-
'local',
36-
'start-lambda',
37-
'--debug',
38-
'--template',
39-
SAM_TEMPLATE_FILE,
40-
'--warm-containers',
41-
'EAGER',
42-
'--docker-network',
43-
DOCKER_NETWORK_NAME,
44-
];
45-
46-
if (process.env.NODE_VERSION) {
47-
args.push('--invoke-image', `public.ecr.aws/sam/build-nodejs${process.env.NODE_VERSION}.x:latest`);
48-
}
49-
50-
const samProcess = spawn('sam', args, {
51-
stdio: ['ignore', debugLog.fd, debugLog.fd],
52-
});
32+
const process = spawn(
33+
'sam',
34+
[
35+
'local',
36+
'start-lambda',
37+
'--debug',
38+
'--template',
39+
SAM_TEMPLATE_FILE,
40+
'--warm-containers',
41+
'EAGER',
42+
'--docker-network',
43+
DOCKER_NETWORK_NAME,
44+
],
45+
{
46+
stdio: ['ignore', debugLog.fd, debugLog.fd],
47+
},
48+
);
5349

5450
try {
5551
await LocalLambdaStack.waitForStack();
@@ -58,12 +54,12 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
5854
} finally {
5955
console.log('[testEnvironment fixture] Tearing down AWS Lambda test infrastructure');
6056

61-
samProcess.kill('SIGTERM');
57+
process.kill('SIGTERM');
6258
await new Promise(resolve => {
63-
samProcess.once('exit', resolve);
59+
process.once('exit', resolve);
6460
setTimeout(() => {
65-
if (!samProcess.killed) {
66-
samProcess.kill('SIGKILL');
61+
if (!process.killed) {
62+
process.kill('SIGKILL');
6763
}
6864
resolve(void 0);
6965
}, 5000);

0 commit comments

Comments
 (0)