Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ jobs:
- name: Build E2E app
working-directory: ${{ runner.temp }}/test-application
timeout-minutes: 7
run: pnpm ${{ matrix.build-command || 'test:build' }}
run: ${{ matrix.build-command || 'pnpm test:build' }}

- name: Install Playwright
uses: ./.github/actions/install-playwright
Expand All @@ -965,7 +965,7 @@ jobs:
- name: Run E2E test
working-directory: ${{ runner.temp }}/test-application
timeout-minutes: 10
run: pnpm test:assert
run: ${{ matrix.assert-command || 'pnpm test:assert' }}

- name: Upload Playwright Traces
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -1075,7 +1075,7 @@ jobs:
- name: Build E2E app
working-directory: ${{ runner.temp }}/test-application
timeout-minutes: 7
run: pnpm ${{ matrix.build-command || 'test:build' }}
run: ${{ matrix.build-command || 'pnpm test:build' }}

- name: Install Playwright
uses: ./.github/actions/install-playwright
Expand All @@ -1086,7 +1086,7 @@ jobs:
- name: Run E2E test
working-directory: ${{ runner.temp }}/test-application
timeout-minutes: 10
run: pnpm ${{ matrix.assert-command || 'test:assert' }}
run: ${{ matrix.assert-command || 'pnpm test:assert' }}

- name: Pre-process E2E Test Dumps
if: failure()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,19 @@
},
"volta": {
"extends": "../../package.json"
},
"sentryTest": {
"variants": [
{
"build-command": "NODE_VERSION=20 ./pull-sam-image.sh && pnpm test:build",
"assert-command": "NODE_VERSION=20 pnpm test:assert",
"label": "aws-serverless (Node 20)"
},
{
"build-command": "NODE_VERSION=18 ./pull-sam-image.sh && pnpm test:build",
"assert-command": "NODE_VERSION=18 pnpm test:assert",
"label": "aws-serverless (Node 18)"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { getPlaywrightConfig } from '@sentry-internal/test-utils';

export default getPlaywrightConfig();
export default getPlaywrightConfig(undefined, {
timeout: 60 * 1000 * 3, // 3 minutes
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Script to pull the correct SAM docker image based on the NODE_VERSION environment variable.

set -e

if [[ -z "$NODE_VERSION" ]]; then
echo "Error: NODE_VERSION not set"
exit 1
fi

echo "Pulling SAM Node $NODE_VERSION docker image..."
docker pull "public.ecr.aws/sam/build-nodejs${NODE_VERSION}.x:latest"

echo "Successfully pulled SAM Node $NODE_VERSION docker image"
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const LAMBDA_FUNCTIONS_WITH_NPM_DIR = './src/lambda-functions-npm';
const LAMBDA_FUNCTION_TIMEOUT = 10;
const LAYER_DIR = './node_modules/@sentry/aws-serverless/';
export const SAM_PORT = 3001;
const NODE_RUNTIME = `nodejs${process.version.split('.').at(0)?.replace('v', '')}.x`;

export class LocalLambdaStack extends Stack {
sentryLayer: CfnResource;
Expand Down Expand Up @@ -73,22 +72,20 @@ export class LocalLambdaStack extends Stack {
execFileSync('npm', ['install', '--prefix', path.join(functionsDir, lambdaDir)], { stdio: 'inherit' });
}

const isEsm = fs.existsSync(path.join(functionsDir, lambdaDir, 'index.mjs'));

new CfnResource(this, functionName, {
type: 'AWS::Serverless::Function',
properties: {
CodeUri: path.join(functionsDir, lambdaDir),
Handler: 'index.handler',
Runtime: NODE_RUNTIME,
Runtime: `nodejs${process.env.NODE_VERSION ?? '22'}.x`,
Timeout: LAMBDA_FUNCTION_TIMEOUT,
Layers: addLayer ? [{ Ref: this.sentryLayer.logicalId }] : undefined,
Environment: {
Variables: {
SENTRY_DSN: dsn,
SENTRY_TRACES_SAMPLE_RATE: 1.0,
SENTRY_DEBUG: true,
NODE_OPTIONS: `--${isEsm ? 'import' : 'require'}=@sentry/aws-serverless/awslambda-auto`,
NODE_OPTIONS: `--import=@sentry/aws-serverless/awslambda-auto`,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,27 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
const debugLog = tmp.fileSync({ prefix: 'sentry_aws_lambda_tests_sam_debug', postfix: '.log' });
console.log(`[test_environment fixture] Writing SAM debug log to: ${debugLog.name}`);

const process = spawn(
'sam',
[
'local',
'start-lambda',
'--debug',
'--template',
SAM_TEMPLATE_FILE,
'--warm-containers',
'EAGER',
'--docker-network',
DOCKER_NETWORK_NAME,
],
{
stdio: ['ignore', debugLog.fd, debugLog.fd],
},
);
const args = [
'local',
'start-lambda',
'--debug',
'--template',
SAM_TEMPLATE_FILE,
'--warm-containers',
'EAGER',
'--docker-network',
DOCKER_NETWORK_NAME,
];

if (process.env.NODE_VERSION) {
args.push('--invoke-image', `public.ecr.aws/sam/build-nodejs${process.env.NODE_VERSION}.x:latest`);
}

console.log(`[testEnvironment fixture] Running SAM with args: ${args.join(' ')}`);

const samProcess = spawn('sam', args, {
stdio: ['ignore', debugLog.fd, debugLog.fd],
});

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

process.kill('SIGTERM');
samProcess.kill('SIGTERM');
await new Promise(resolve => {
process.once('exit', resolve);
samProcess.once('exit', resolve);
setTimeout(() => {
if (!process.killed) {
process.kill('SIGKILL');
if (!samProcess.killed) {
samProcess.kill('SIGKILL');
}
resolve(void 0);
}, 5000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"sentryTest": {
"variants": [
{
"build-command": "test:build-13",
"build-command": "pnpm test:build-13",
"label": "create-next-app (next@13)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"sentryTest": {
"variants": [
{
"build-command": "test:build-ts3.8",
"build-command": "pnpm test:build-ts3.8",
"label": "create-react-app (TS 3.8)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"sentryTest": {
"optionalVariants": [
{
"build-command": "test:build-canary",
"build-command": "pnpm test:build-canary",
"label": "nextjs-13 (canary)"
},
{
"build-command": "test:build-latest",
"build-command": "pnpm test:build-latest",
"label": "nextjs-13 (latest)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
"sentryTest": {
"optionalVariants": [
{
"build-command": "test:build-canary",
"build-command": "pnpm test:build-canary",
"label": "nextjs-14 (canary)"
},
{
"build-command": "test:build-latest",
"build-command": "pnpm test:build-latest",
"label": "nextjs-14 (latest)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
"sentryTest": {
"optionalVariants": [
{
"build-command": "test:build-canary",
"build-command": "pnpm test:build-canary",
"label": "nextjs-15 (canary)"
},
{
"build-command": "test:build-latest",
"build-command": "pnpm test:build-latest",
"label": "nextjs-15 (latest)"
},
{
"build-command": "test:build-turbo",
"build-command": "pnpm test:build-turbo",
"assert-command": "pnpm test:prod && pnpm test:dev-turbo",
"label": "nextjs-15 (turbo)"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
"sentryTest": {
"variants": [
{
"build-command": "test:build-13",
"build-command": "pnpm test:build-13",
"label": "nextjs-app-dir (next@13)"
}
],
"optionalVariants": [
{
"build-command": "test:build-canary",
"build-command": "pnpm test:build-canary",
"label": "nextjs-app-dir (canary)"
},
{
"build-command": "test:build-latest",
"build-command": "pnpm test:build-latest",
"label": "nextjs-app-dir (latest)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
"sentryTest": {
"variants": [
{
"build-command": "test:build-13",
"build-command": "pnpm test:build-13",
"label": "nextjs-pages-dir (next@13)"
}
],
"optionalVariants": [
{
"build-command": "test:build-canary",
"build-command": "pnpm test:build-canary",
"label": "nextjs-pages-dir (canary)"
},
{
"build-command": "test:build-latest",
"build-command": "pnpm test:build-latest",
"label": "nextjs-pages-dir (latest)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
"optional": true,
"optionalVariants": [
{
"build-command": "test:build-canary",
"build-command": "pnpm test:build-canary",
"label": "nextjs-turbo (canary)"
},
{
"build-command": "test:build-latest",
"build-command": "pnpm test:build-latest",
"label": "nextjs-turbo (latest)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"sentryTest": {
"optionalVariants": [
{
"build-command": "test:build-canary",
"build-command": "pnpm test:build-canary",
"label": "nuxt-3 (canary)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"sentryTest": {
"optionalVariants": [
{
"build-command": "test:build-canary",
"build-command": "pnpm test:build-canary",
"label": "nuxt-4 (canary)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"sentryTest": {
"variants": [
{
"build-command": "test:build-ts3.8",
"build-command": "pnpm test:build-ts3.8",
"label": "react-router-6 (TS 3.8)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"sentryTest": {
"variants": [
{
"build-command": "test:build-ts3.8",
"build-command": "pnpm test:build-ts3.8",
"label": "react-router-7-spa (TS 3.8)"
}
]
Expand Down
Loading