Skip to content

test(aws): Run E2E tests with AWS SAM #17367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 12, 2025
Merged

test(aws): Run E2E tests with AWS SAM #17367

merged 6 commits into from
Aug 12, 2025

Conversation

msonnb
Copy link
Member

@msonnb msonnb commented Aug 11, 2025

Introduces new E2E tests for AWS Lambda that run in a Lambda runtime using AWS SAM and the AWS CDK, inspired by https://vanguard.getsentry.net/p/cm7ysk0mz0000c7sk3e2qx3sx

@msonnb msonnb self-assigned this Aug 11, 2025
@msonnb msonnb changed the base branch from develop to ms/aws-streaming-2 August 11, 2025 07:25
Copy link
Contributor

github-actions bot commented Aug 11, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.16 kB - -
@sentry/browser - with treeshaking flags 22.73 kB - -
@sentry/browser (incl. Tracing) 39.87 kB - -
@sentry/browser (incl. Tracing, Replay) 77.99 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.83 kB -0.01% -1 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 82.69 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 94.79 kB - -
@sentry/browser (incl. Feedback) 40.83 kB - -
@sentry/browser (incl. sendFeedback) 28.81 kB - -
@sentry/browser (incl. FeedbackAsync) 33.7 kB - -
@sentry/react 25.88 kB - -
@sentry/react (incl. Tracing) 41.86 kB - -
@sentry/vue 28.64 kB - -
@sentry/vue (incl. Tracing) 41.69 kB - -
@sentry/svelte 24.18 kB - -
CDN Bundle 25.66 kB - -
CDN Bundle (incl. Tracing) 39.76 kB - -
CDN Bundle (incl. Tracing, Replay) 75.82 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 81.27 kB - -
CDN Bundle - uncompressed 74.96 kB - -
CDN Bundle (incl. Tracing) - uncompressed 117.59 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 231.88 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 244.48 kB - -
@sentry/nextjs (client) 43.89 kB - -
@sentry/sveltekit (client) 40.32 kB - -
@sentry/node-core 47.81 kB +0.01% +1 B 🔺
@sentry/node 146.83 kB - -
@sentry/node - without tracing 92.04 kB - -
@sentry/aws-serverless 103.47 kB - -

View base workflow run

@msonnb msonnb changed the base branch from ms/aws-streaming-2 to develop August 11, 2025 07:51
@msonnb msonnb changed the title [WIP] test(aws): Run E2E tests with AWS SAM test(aws): Run E2E tests with AWS SAM Aug 12, 2025
@msonnb msonnb marked this pull request as ready for review August 12, 2025 07:06
@msonnb msonnb requested a review from andreiborza August 12, 2025 07:06
import { test as base, expect } from '@playwright/test';
import { App } from 'aws-cdk-lib';
import * as tmp from 'tmp';
import { LocalLambdaStack, SAM_PORT, getHostIp } from '../src/stack.js';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Test Runner Fails on Module Resolution

E2E tests fail due to module resolution errors. lambda-fixtures.ts imports ../src/stack.js and npm.test.ts imports ./lambda-fixtures.js, but the corresponding files only exist as .ts (e.g., src/stack.ts, lambda-fixtures.ts). The Playwright/TS test runner cannot resolve these .js imports to .ts files without a build step, resulting in "Cannot find module" errors and preventing the SAM test environment from starting.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems right, shouldn't have a file ending right?

@@ -0,0 +1,169 @@
import { waitForTransaction, waitForError } from '@sentry-internal/test-utils';
import { InvokeCommand } from '@aws-sdk/client-lambda';
import { test, expect } from './lambda-fixtures.js';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect File Extension in TypeScript Import

The layer.test.ts file incorrectly imports ./lambda-fixtures.js. Since the actual file is lambda-fixtures.ts, Playwright's TypeScript runtime fails to resolve the .js extension, causing a module-not-found error. This breaks the new SAM E2E tests in CI. The import should be ./lambda-fixtures or ./lambda-fixtures.ts.

Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this too.

Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement, let's also write a vanguard about it!

import { test as base, expect } from '@playwright/test';
import { App } from 'aws-cdk-lib';
import * as tmp from 'tmp';
import { LocalLambdaStack, SAM_PORT, getHostIp } from '../src/stack.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems right, shouldn't have a file ending right?

@@ -0,0 +1,169 @@
import { waitForTransaction, waitForError } from '@sentry-internal/test-utils';
import { InvokeCommand } from '@aws-sdk/client-lambda';
import { test, expect } from './lambda-fixtures.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this too.

@@ -0,0 +1,141 @@
import { waitForTransaction } from '@sentry-internal/test-utils';
import { InvokeCommand } from '@aws-sdk/client-lambda';
import { test, expect } from './lambda-fixtures.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { test, expect } from './lambda-fixtures.js';
import { test, expect } from './lambda-fixtures';

@msonnb msonnb merged commit 8c7f99e into develop Aug 12, 2025
184 checks passed
@msonnb msonnb deleted the ms/aws-e2e-tests branch August 12, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants