-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is there an existing issue for this?
- I have searched the existing issues
How do you use Sentry?
Sentry SaaS
Which SDK are you using?
@sentry/sveltekit
SDK Version
10.45.0
I suspect this may also affect 10.44.0, but I confirmed it with 10.45.0.
Framework Version
@sveltejs/kit:2.55.0vite:8.0.1@sveltejs/adapter-vercel:6.3.3
Runtime / Deployment Target
- Vercel
- Node.js 24.x
Reproduction Example / Repo
Repo: https://github.com/TGilany/couch-potato
PR showing the regression: https://github.com/TGilany/couch-potato/pull/76
Steps to Reproduce
- Have a SvelteKit app with a
vite.config.tsthat importssentrySvelteKitfrom@sentry/sveltekit - Upgrade
@sentry/sveltekitto10.45.0 - Deploy to Vercel
- Build fails while loading
vite.config.ts
Expected Result
If Sentry is not actually enabled for the build, importing the Vite config should not fail.
More generally, @sentry/sveltekit should not cause a Vercel build failure during config evaluation due to transitive telemetry dependencies.
Actual Result
Vercel fails before the app build completes with:
failed to load config from /vercel/path0/vite.config.ts
error during build:
Error: Cannot find package '/vercel/path0/node_modules/@prisma/instrumentation/node_modules/@opentelemetry/instrumentation/index.js' imported from /vercel/path0/node_modules/@prisma/instrumentation/dist/index.mjs
Did you mean to import "@opentelemetry/instrumentation/build/src/index.js"?
at legacyMainResolve (node:internal/modules/esm/resolve:204:26)
at packageResolve (node:internal/modules/esm/resolve:778:12)
at moduleResolve (node:internal/modules/esm/resolve:858:18)
at defaultResolve (node:internal/modules/esm/resolve:990:11)
at #cachedDefaultResolve (node:internal/modules/esm/loader:718:20)
at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:735:38)
at ModuleLoader.resolveSync (node:internal/modules/esm/loader:764:52)
at #resolve (node:internal/modules/esm/loader:700:17)
at ModuleLoader.getOrCreateModuleJob (node:internal/modules/esm/loader:620:35)
at ModuleJob.syncLink (node:internal/modules/esm/module_job:143:33) {
code: 'ERR_MODULE_NOT_FOUND'
}
✖ 'vite build' failed
error: script "build" exited with code 1
Error: Command "bun run build" exited with 1Investigation
From the installed dependency tree:
@sentry/sveltekit@10.45.0depends on@sentry/node@10.45.0@sentry/node@10.45.0depends on@prisma/instrumentation@7.4.2@prisma/instrumentation/dist/index.mjsimports@opentelemetry/instrumentation
This means that simply importing @sentry/sveltekit in vite.config.ts is enough to trigger the failing resolution path on Vercel/Node 24, even before application code builds.
Temporary Workaround
I worked around this by lazy-loading @sentry/sveltekit inside defineConfig(async () => ...) only when Sentry env vars are actually present:
export default defineConfig(async () => {
const plugins = [tailwindcss(), sveltekit()];
if (process.env.SENTRY_ORG && process.env.SENTRY_PROJECT) {
const { sentrySvelteKit } = await import('@sentry/sveltekit');
plugins.unshift(
sentrySvelteKit({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
})
);
}
return { plugins };
});This avoids the Vercel failure in my app.
Question
Should @sentry/sveltekit be avoiding this eager import path, or is there a known issue with the current @sentry/node -> @prisma/instrumentation -> @opentelemetry/instrumentation chain under Node 24 / Vercel?
Metadata
Metadata
Assignees
Fields
Give feedbackProjects
Status