Official Sentry SDK for SvelteKit

Compatibility
The minimum supported version of SvelteKit is 2.0.0
. The SDK works best with Vite 4.2 and newer. Older Vite versions
might not generate source maps correctly.
Check our docs for SvelteKit adapter compatibility.
General
This package is a wrapper around @sentry/node
for the server and @sentry/svelte
for the client side, with added
functionality related to SvelteKit.
Installation
To get started installing the SDK, use the Sentry Next.js Wizard by running the following command in your terminal or
read the Getting Started Docs:
npx @sentry/wizard@latest -i sveltekit
The wizard will guide you throuhg logging in to Sentry and setting up the SDK. After the wizard setup is completed, the SDK will automatically capture
unhandled errors, and optionally, traces and replays.
Links
9.40.0
Important Changes
- feat(browser): Add debugId sync APIs between web worker and main thread (#16981)
This release adds two Browser SDK APIs to let the main thread know about debugIds of worker files:
webWorkerIntegration({worker})
to be used in the main thread
registerWebWorker({self})
to be used in the web worker
// main.js
Sentry.init({...})
const worker = new MyWorker(...);
Sentry.addIntegration(Sentry.webWorkerIntegration({ worker }));
worker.addEventListener('message', e => {...});
// worker.js
Sentry.registerWebWorker({ self });
self.postMessage(...);
- feat(core): Deprecate logger in favor of debug (#17040)
The internal SDK logger
export from @sentry/core
has been deprecated in favor of the debug
export. debug
only exposes log
, warn
, and error
methods but is otherwise identical to logger
. Note that this deprecation does not affect the logger
export from other packages (like @sentry/browser
or @sentry/node
) which is used for Sentry Logging.
import { logger, debug } from '@sentry/core';
// before
logger.info('This is an info message');
// after
debug.log('This is an info message');
- feat(node): Add OpenAI integration (#17022)
This release adds official support for instrumenting OpenAI SDK calls in with Sentry tracing, following OpenTelemetry semantic conventions for Generative AI. It instruments:
client.chat.completions.create()
- For chat-based completions
client.responses.create()
- For the responses API
// The integration respects your `sendDefaultPii` option, but you can override the behavior in the integration options
Sentry.init({
dsn: '__DSN__',
integrations: [
Sentry.openAIIntegration({
recordInputs: true, // Force recording prompts
recordOutputs: true, // Force recording responses
}),
],
});
Other Changes
- feat(node-core): Expand
@opentelemetry/instrumentation
range to cover 0.203.0
(#17043)
- fix(cloudflare): Ensure errors get captured from durable objects (#16838)
- fix(sveltekit): Ensure server errors from streamed responses are sent (#17044)
Work in this release was contributed by @0xbad0c0d3 and @tommy-gilligan. Thank you for your contributions!