Is there an existing issue for this?
I searched the issues for cp is not defined and related SvelteKit build errors, and found nothing.
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK are you using?
@sentry/sveltekit
SDK Version
11.4.0 (also seen on 11.0.0). 10.x builds fine with the same project and config.
Framework Version
@sveltejs/kit 2.70.3, svelte 5.57.1, vite 7.3.6, rollup 4.59.0, @sveltejs/adapter-vercel 6.3.4, Node 24.13.1
Steps to Reproduce
- A SvelteKit app on
@sveltejs/adapter-vercel, upgraded from @sentry/sveltekit 10.x to 11.4.0.
vite.config.ts (the 11.x import path):
import { sentrySvelteKit } from '@sentry/sveltekit/vite';
export default defineConfig({
plugins: [
sentrySvelteKit({ org: '…', project: '…', authToken: process.env.SENTRY_AUTH_TOKEN }),
sveltekit()
]
});
vite build
Expected Result
The build succeeds, as it does on 10.x.
Actual Result
Vite and Rollup finish, then SvelteKit's post-build analyse step crashes while importing a server chunk:
ReferenceError: cp is not defined
at file:///…/.svelte-kit/output/server/chunks/node.js:26:18
at ModuleJob.run (node:internal/modules/esm/module_job:439:25)
at async node:internal/modules/esm/loader:643:26
at async analyse (…/@sveltejs/kit/src/core/postbuild/analyse.js:47:19)
at async MessagePort.<anonymous> (…/@sveltejs/kit/src/utils/fork.js:23:16)
The generated chunk keeps node:child_process as a side-effect-only import, but still references the binding:
import "node:child_process";
import "node:crypto";
import * as fssync from "node:fs";
import * as path from "node:path";
import "node:stream";
import "node:util";
// … SvelteKit's shared-server env exports …
const node = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
child_process: cp, // <- `cp` is never declared
crypto,
fs: fssync,
path,
stream,
util
}, Symbol.toStringTag, { value: "Module" }));
The chunk's source map lists only @sveltejs/kit/src/runtime/shared-server.js. No importer uses the node export; they import only SvelteKit's public_env and private_env from this chunk.
What I narrowed down
Every build below used the same project and the same lockfile, with VERCEL=1:
| Configuration |
Result |
@sentry/sveltekit 11.4.0, sentrySvelteKit() not in plugins |
✅ builds |
No Sentry plugin, but build.sourcemap: 'hidden' |
✅ builds |
11.4.0 with sentrySvelteKit({ org, project, authToken }) |
❌ cp is not defined |
… plus autoInstrument: false |
❌ |
… plus release: { inject: false } |
❌ |
… plus sourcemaps: { disable: true } |
❌ |
… with all three, and adapter: 'vercel' or adapter: 'other' |
❌ |
@sentry/sveltekit 10.75.0 with the equivalent 10.x config |
✅ builds |
So the failure appears whenever sentrySvelteKit() is in the plugin list, whichever of its features are switched off. Source maps on their own are not the cause.
Additional Context
We're staying on 10.x until this is fixed. Happy to test a patched build. I can't share the app itself, but I can try particular options or provide more of the generated output.
Is there an existing issue for this?
I searched the issues for
cp is not definedand related SvelteKit build errors, and found nothing.How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK are you using?
@sentry/sveltekit
SDK Version
11.4.0 (also seen on 11.0.0). 10.x builds fine with the same project and config.
Framework Version
@sveltejs/kit 2.70.3, svelte 5.57.1, vite 7.3.6, rollup 4.59.0, @sveltejs/adapter-vercel 6.3.4, Node 24.13.1
Steps to Reproduce
@sveltejs/adapter-vercel, upgraded from@sentry/sveltekit10.x to 11.4.0.vite.config.ts(the 11.x import path):vite buildExpected Result
The build succeeds, as it does on 10.x.
Actual Result
Vite and Rollup finish, then SvelteKit's post-build
analysestep crashes while importing a server chunk:The generated chunk keeps
node:child_processas a side-effect-only import, but still references the binding:The chunk's source map lists only
@sveltejs/kit/src/runtime/shared-server.js. No importer uses thenodeexport; they import only SvelteKit'spublic_envandprivate_envfrom this chunk.What I narrowed down
Every build below used the same project and the same lockfile, with
VERCEL=1:@sentry/sveltekit11.4.0,sentrySvelteKit()not in pluginsbuild.sourcemap: 'hidden'sentrySvelteKit({ org, project, authToken })cp is not definedautoInstrument: falserelease: { inject: false }sourcemaps: { disable: true }adapter: 'vercel'oradapter: 'other'@sentry/sveltekit10.75.0 with the equivalent 10.x configSo the failure appears whenever
sentrySvelteKit()is in the plugin list, whichever of its features are switched off. Source maps on their own are not the cause.Additional Context
We're staying on 10.x until this is fixed. Happy to test a patched build. I can't share the app itself, but I can try particular options or provide more of the generated output.