Skip to content

chore(ci): Do not build AWS lambda layer in build step#20357

Open
mydea wants to merge 13 commits intodevelopfrom
fn/faster-lambda-layer-build
Open

chore(ci): Do not build AWS lambda layer in build step#20357
mydea wants to merge 13 commits intodevelopfrom
fn/faster-lambda-layer-build

Conversation

@mydea
Copy link
Copy Markdown
Member

@mydea mydea commented Apr 16, 2026

To slightly improve build times, I figured we can actually skip building the AWS lambda layer all the time in our build step, as, AFAIK, we don't really need this for any tests etc. Instead, we only need this when uploading artifacts for publishing, so I moved this into that step. To ensure we do not accidentally regress this, I also added a standalone job that can run in parallel that verifies that building this still works.

mydea and others added 3 commits April 16, 2026 16:23
…install

Replace `file:` directory references with `npm pack` tarballs when
installing @sentry/* packages into the Lambda layer's node_modules.

Previously, `yarn install` used `file:` references to workspace packages
with a fresh cache folder (to avoid stale cache issues), taking ~52s.
With tarballs, yarn can use its global cache and the install completes
in ~8s. Only transitive dependencies of @sentry/aws-serverless are
packed (~5 packages), keeping the packing step fast.

Total layer build time: ~97s → ~15s.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead, only build this before uploading artifacts, as we do not really need this before.
@mydea mydea requested a review from andreiborza April 16, 2026 14:44
@mydea mydea self-assigned this Apr 16, 2026
Comment thread .github/workflows/build.yml Outdated
Copy link
Copy Markdown
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.

Generally looks good to me, we just need to be careful about build:extension as it is important for the npm package too now. As long as build:layer is called before publishing the npm package this works. I don't know off the top of my head if that's the case tho.

Edit: ah yea what cursor is saying above. Tbh I'd just keep the build:extension step but exclude build:layer from build.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 16, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.78 kB - -
@sentry/browser - with treeshaking flags 24.27 kB - -
@sentry/browser (incl. Tracing) 43.65 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 45.36 kB - -
@sentry/browser (incl. Tracing, Profiling) 48.58 kB - -
@sentry/browser (incl. Tracing, Replay) 82.79 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 72.29 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 87.49 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 99.74 kB - -
@sentry/browser (incl. Feedback) 42.59 kB - -
@sentry/browser (incl. sendFeedback) 30.45 kB - -
@sentry/browser (incl. FeedbackAsync) 35.45 kB - -
@sentry/browser (incl. Metrics) 27.07 kB - -
@sentry/browser (incl. Logs) 27.2 kB - -
@sentry/browser (incl. Metrics & Logs) 27.89 kB - -
@sentry/react 27.53 kB - -
@sentry/react (incl. Tracing) 45.92 kB - -
@sentry/vue 30.61 kB - -
@sentry/vue (incl. Tracing) 45.49 kB - -
@sentry/svelte 25.8 kB - -
CDN Bundle 28.46 kB - -
CDN Bundle (incl. Tracing) 44.73 kB - -
CDN Bundle (incl. Logs, Metrics) 29.83 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 45.81 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.73 kB - -
CDN Bundle (incl. Tracing, Replay) 81.68 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 82.77 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 87.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 88.27 kB - -
CDN Bundle - uncompressed 83.12 kB - -
CDN Bundle (incl. Tracing) - uncompressed 133.75 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 87.27 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 137.17 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 210.63 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 250.99 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 254.38 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 263.9 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 267.29 kB - -
@sentry/nextjs (client) 48.44 kB - -
@sentry/sveltekit (client) 44.09 kB - -
@sentry/node-core 57.94 kB +0.02% +6 B 🔺
@sentry/node 174.77 kB +0.01% +8 B 🔺
@sentry/node - without tracing 97.89 kB +0.03% +20 B 🔺
@sentry/aws-serverless 115.12 kB +0.01% +8 B 🔺

View base workflow run

Comment thread packages/aws-serverless/package.json Outdated
Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml
Comment thread .github/workflows/build.yml
Comment thread .github/workflows/build.yml
Comment thread .github/workflows/build.yml
Comment thread .github/workflows/build.yml
Comment thread .github/workflows/build.yml
Comment thread package.json Outdated
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f1e1d97. Configure here.

job_build_layer:
name: Build Lambda layer
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_aws_serverless == 'true' || github.event_name != 'pull_request'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

E2E test fails when layer artifact is missing

Medium Severity

The job_build_layer condition checks only if @sentry/aws-serverless is in the Nx affected list, but the E2E matrix includes aws-serverless whenever any Sentry dependency of the test app is affected. The aws-serverless E2E app also depends on @sentry-internal/test-utils. If a PR changes only test-utils, job_build_layer is skipped (no build-layer-output artifact uploaded), yet the aws-serverless E2E test is still included in the matrix and attempts to download the missing artifact, causing a CI failure.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f1e1d97. Configure here.

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