Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/sveltekit
SDK Version
7.64.0
Framework Version
1.22.6
Link to Sentry event
No response
SDK Setup
Sentry.init({
dsn: "https://7f6570917828021f8dea53dc2b778775@o1098001.ingest.sentry.io/4505744165699584",
tracesSampleRate: 1,
environment: PUBLIC_DEPLOY_ENV,
debug: true,
});
Steps to Reproduce
I have a Sveltekit project with Sentry set up according to the directions. In local development, everything works as excepted. In a vercel deployment, exception capturing is failing in the following way:
When I capture exceptions manually in a handle
hook, it works just fine - so sentry has clearly been set up correctly.
However, capturing an exception from anywhere else in the application outside the handle
hook, or in a manually created handleError
hook, does not work. Needless to say the Sentry.handleErrorWithSentry()
default handleError
hook does not work either.
Expected Result
Errors should show up in the sentry console.
Actual Result
No server-side errors, either the manually captured error or the error captured in the handleError
hook are captured. Those captured as a test in the handle
hook appear just fine.
Here is a request log from the failing transaction with sentry debug enabled. The code for this endpoint is:
export const GET = async () => {
captureException(new Error("Manually captured API Route Error"));
throw new Error("Sentry Example API Route Error");
};
Sentry Logger [log]: [Tracing] Adding sentry-trace header 5f26faf8ada34e05ba10d48404f0a80a-8b4ee351a68e3c73-0 to outgoing request to "http://127.0.0.1:34673/":
Sentry Logger [log]: [Tracing] starting http.server transaction - GET /sentry-example
Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'GET /sentry-example' (b3b9f273ae588e38).
Sentry Logger [log]: [Tracing] Finishing 'http.client' span on transaction 'GET /sentry-example' (b3b9f273ae588e38).
Error: Sentry Example API Route Error
at GET (file:///var/task/vercel/path0/.svelte-kit/output/server/entries/endpoints/sentry-example/_server.js:5:9)
at render_endpoint (file:///var/task/vercel/path0/.svelte-kit/output/server/index.js:218:26)
at resolve (file:///var/task/vercel/path0/.svelte-kit/output/server/index.js:2644:28)
at async /var/task/vercel/path0/node_modules/@sentry/sveltekit/cjs/server/handle.js:112:19
Error: Sentry Example API Route Error
at GET (file:///var/task/vercel/path0/.svelte-kit/output/server/entries/endpoints/sentry-example/_server.js:5:9)
at render_endpoint (file:///var/task/vercel/path0/.svelte-kit/output/server/index.js:218:26)
at resolve (file:///var/task/vercel/path0/.svelte-kit/output/server/index.js:2644:28)
at async /var/task/vercel/path0/node_modules/@sentry/sveltekit/cjs/server/handle.js:112:19
Sentry Logger [log]: [Tracing] Finishing http.server transaction: GET /sentry-example.
Metadata
Metadata
Assignees
Type
Projects
Status