Capture & report errors
Unexpected errors go through SvelteKit hooks. Use the server runtime to report handled errors.
Unexpected errors
Server and client handleError report unexpected
failures. Browser hooks also catch window errors and unhandled rejections. error(), redirect(), and fail() are not reported. Server handleError attaches runtime recorder evidence when
the recorder is on.
Capture exceptions
Call captureException on the server runtime for
handled errors. Pass observation from scope.observeError(error) to attach recorder
evidence.
try {
await chargeCustomer();
} catch (error) {
const observation = scope.observeError(error);
server.captureException(error, { observation });
}Send pending events before exit
adapter-node servers flush on shutdown. Call flush yourself before a script or other short-lived
process exits.
await server.flush();Client and server options
Server fields go to node(). Client fields go to rasputinClientHooks. Never pass a project API key
to client hooks.
| Field | Where | Required | What it does |
|---|---|---|---|
dsn | Both | Required | Public project DSN from project settings. Used only to send events. |
projectApiKey | Server | Required | Secret project API key for deploy announcement and instrumentation manifest upload. Never pass this to client hooks. |
environment | Both | Required | Where the error happened, such as production or staging. |
release | Both | Required | The Git commit SHA for this deployment. Use the same SHA on the Vite plugin. |
enabled | Both | Optional | Turns reporting on or off. Defaults to true. |
logSuccess | Both | Optional | Prints a configuration summary when setup succeeds. Defaults to false; set to true to enable. |
scrubPII | Both | Optional | Redact common personal data from stored runtime state (default false). Set to true to enable; secrets are always redacted. |
installGlobalHandlers | Both | Optional | On the client, watch window error and unhandledrejection (default on). On the server, watch process failures (default off). |
executionRecorder | Server | Optional | Limits and redaction for the runtime recorder (on after install). |
moduleUrl | Server | Optional | Helps normalize local stack paths. Use import.meta.url. |
sourceRoot | Server | Optional | The Git folder for a single-package service when automatic matching is ambiguous. |
sourceRoots | Server | Optional | Package-name to Git-folder mappings for an ambiguous monorepo. |
apiUrl | Both | Optional | Override the API origin from the DSN. Leave unset unless you self-host. |
