Repository navigation
fix: externalise @opentelemetry/api during build - #17081
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/89b8b524399b893bb4e9dc181fcd12385d5d8f22Open in |
|
|
I investigated this failed test run, but the investigation came up empty. What I tried
The unchanged target is flaky, but its test logic never failed: Windows CI lost the Chrome worker before browser.newContext could create the test context, causing one final failure and nine unrelated retry-pass flakes. Linux cannot reproduce the Windows runner itself, but broad-suite runs reproduced the same cross-test browser-death mechanism explicitly as Chrome SEGV_MAPERR 0x1b0, while five separate focused runs, 100 same-process build repetitions, and 20 dev repetitions all passed. Crucially, the identical process-level failure reproduced on the exact base SHA and was attributed to varying unrelated tests, so PR #17081 is not responsible. Historical SvelteKit PR #15209 records the exact Chrome/Playwright crash signature. No safe standalone repository fix was found: changing this test cannot prevent a worker browser crash, lowering parallelism is not robust because one one-worker run also crashed, and workflow changes are prohibited. No branch was pushed. |
elliott-with-the-longest-name-on-github
left a comment
There was a problem hiding this comment.
Oops, thanks
7bf4fee
into
version-3
… 3 (#24736) Since `@sveltejs/kit@next.28`, PR sveltejs/kit#17081, `@opentelemetry/api` is externalized from the sveltekit server build. Thus the dynamic import of `@opentelemetry/api` remains untouched during build, meaning the API package is now a required dependency module during runtime. This is technically correct and fine for anyone using a default OTel setup, where users would install `@opentelemetry/api` anyway. However, for Sentry users, `@opentelemetry/api` is a transitive dependency of `@sentry/node`, so not a direct app dependency. When users use `pnpm` or Yarn `pnp`, dynamic imports can only resolve direct dependencies and not transitive deps. This broke our e2e tests. To avoid having to make the Sentry SDK more complicated by instructing users to manually install `@opentelemetry/api`, this PR adds a bit of a "redirection workaround" to our package, to get the dynamic import working again without user intervention: This PR: - Adds `@opentelemetry/api` as a dep of `@sentry/sveltekit` - Exports `@opentelemetry/api` from Sveltekit SDK package as subpath export - Adds a vite plugin to redirect id resolving of `@opentelemetry/api` And point Vite to our subpath export instead. Kit 3 E2E tests pass again with this fix. Caveat: This redirection always applies, so if users actively installed both `@sentry/sveltekit` and `@opentelemetry/api`, our Vite plugin now always redirects the import to our version of the OTel API package. If this causes problems, we can revisit the fix and offer an opt out possibility of the redirection for example. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…eKit 3 (#25105) Backport of #24736 Since `@sveltejs/kit@3.0.0-next.28` (sveltejs/kit#17081), the SvelteKit server build keeps `@opentelemetry/api` external. With `tracing.server` enabled, SvelteKit imports it at runtime from the app. Under pnpm or Yarn PnP, the app cannot resolve it, because it is only a transitive dependency of `@sentry/node`. Then SvelteKit fails every request with `tracing_api_missing`. This is also why the `sveltekit-3` e2e app fails on v10 against stable SvelteKit 3. `@sentry/sveltekit` now depends on `@opentelemetry/api`, re-exports it as `@sentry/sveltekit/opentelemetry-api`, and the `sentrySvelteKit()` Vite plugin redirects SvelteKit's import to that re-export. ## Differences to the original PR - `packages/sveltekit/package.json`: v10 has no `./vite` subpath export, so only the `./opentelemetry-api` export is added. The dependency list keeps the v10 packages and only adds `@opentelemetry/api`. - `packages/sveltekit/rollup.npm.config.mjs`: only adds the `src/opentelemetryApi.ts` entry point, not `src/vite/index.ts`. - `packages/sveltekit/test/vite/sentrySvelteKitPlugins.test.ts`: v10 has no orchestrion Vite plugin, so the expected plugin counts are one lower than on `develop`. Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
I think this was accidentally added such that it only affected
vite dev. This PR moves it out of the dev-only conditional block.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits