Capture & report errors
Unexpected errors go through server hooks. Use the Node runtime to report handled errors.
Unexpected errors
Server handleError reports unexpected failures. 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();Server options
Pass these fields to node().
| Field | Required | What it does |
|---|---|---|
dsn | Required | Public project DSN from project settings. Used only to send events. |
projectApiKey | Required | Secret project API key for deploy announcement and source-inventory upload. |
environment | Required | Where the error happened: local, staging, or production. |
release | Required | The Git commit SHA for this deployment. Use the same SHA on the Vite plugin. |
enabled | Optional | Turns reporting on or off. Defaults to true. |
logSuccess | Optional | Prints a configuration summary when setup succeeds. Defaults to false; set to true to enable. |
installGlobalHandlers | Optional | Watch process uncaughtException and unhandledRejection. Defaults to off; set to true to enable. |
executionRecorder | Optional | Limits and redaction for the runtime recorder (on after install). |
moduleUrl | Optional | Helps normalize local stack paths. Use import.meta.url. |
sourceRoot | Optional | The Git folder for a single-package service when automatic matching is ambiguous. |
sourceRoots | Optional | Package-name to Git-folder mappings for an ambiguous monorepo. |
apiUrl | Optional | Override the API origin from the DSN. Leave unset unless you self-host. |
