@sentry/bun, instruments your application to automatically collect error and performance data.
If you don’t have a Sentry account and project yet, create one at sentry.io, then return to this page.
First, install the Sentry Bun SDK.
terminal
Then initialize the SDK with your Sentry DSN in its own file. You can find your DSN in your Sentry project settings.
sentry.ts
Start your app with
--preload so this file runs before any of your app’s modules. A file’s imports are evaluated before its own code, so calling Sentry.init() at the top of your entry file would still run after everything that file imports.
terminal
Verify that Sentry is working by capturing a test error:
sentry.ts
To learn more about the Sentry Bun SDK, see the Sentry documentation.