← All platforms

SvelteKit error tracking

A server route or a page in the browser. Wherever SvelteKit breaks, the Sentry SDK can send the report to your Telebugs server.

~/hoofnotes  npm install @sentry/sveltekit
~/hoofnotes  nvim svelte.config.js src/hooks.client.ts src/instrumentation.server.ts src/hooks.server.ts
import adapter from "@sveltejs/adapter-auto";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
// SvelteKit 2.31+: merge into your existing configuration.
export default {
preprocess: vitePreprocess(),
kit: {
adapter: adapter(),
experimental: { instrumentation: { server: true } },
},
};
import * as Sentry from "@sentry/sveltekit";
Sentry.init({
// Copy the complete Telebugs DSN, key and path included.
dsn: "YOUR_TELEBUGS_DSN",
});
export const handleError = Sentry.handleErrorWithSentry();
// Remove this test once it appears in Telebugs.
Sentry.captureException(new Error("Hoof Notes: browser check"));
import * as Sentry from "@sentry/sveltekit";
Sentry.init({
// Copy the complete Telebugs DSN, key and path included.
dsn: "YOUR_TELEBUGS_DSN",
});
// Remove this test once it appears in Telebugs.
Sentry.captureException(new Error("Hoof Notes: server check"));
import * as Sentry from "@sentry/sveltekit";
export const handle = Sentry.sentryHandle();
export const handleError = Sentry.handleErrorWithSentry();
~/hoofnotes  npm run dev -- --open

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep @sentry/sveltekit. Point it at your Telebugs DSN and keep reporting errors as before. The reports go to your server; you don’t need a Sentry account.

Does this cover server routes as well as pages?

Yes. The Sentry integration connects to SvelteKit’s server and client error hooks. Unexpected errors from either side can reach Telebugs.

Will the backtrace point to my source files?

Yes. Give Telebugs the matching source maps and it can show the source files you actually work in, with filenames and line numbers, instead of a minified backtrace.