Skip to content

Commit 5785050

Browse files
docs(js): Update Bun quick start guide: users need to preload instrumentation file (#15575)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR Updated Bun's Quick Start guide: - users need to `--preload` their instrumentation file to make sure Bun loads Sentry before other modules Closes: #15539 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: Sigrid <[email protected]>
1 parent 18608d6 commit 5785050

File tree

1 file changed

+5
-10
lines changed
  • docs/platforms/javascript/guides/bun

1 file changed

+5
-10
lines changed

docs/platforms/javascript/guides/bun/index.mdx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ bun add @sentry/bun
3434
### Initialize the Sentry SDK
3535

3636
Sentry should be initialized as early in your app as possible.
37-
To import and initialize Sentry, create a file named `instrument.js` in the root directory of your project and add the following code:
37+
Create a file named `instrument.js` in the root directory of your project and add the following code:
3838

3939
```javascript {filename: instrument.js}
4040
import * as Sentry from "@sentry/bun";
@@ -65,16 +65,11 @@ Sentry.init({
6565

6666
### Apply Instrumentation to Your App
6767

68-
Import `instrument.js` before any other modules to make sure Sentry initializes early. If you initialize later, auto-instrumentation and modules like tracing may not work.
68+
To make sure that Sentry initializes before any other modules, you need to preload your instrumentation file using the [`--preload`](https://bun.com/docs/runtime#param-preload) flag.
69+
Start your app using:
6970

70-
```javascript {filename: app.js}
71-
// Import this first!
72-
import "./instrument";
73-
74-
// Now import other modules
75-
import http from "http";
76-
77-
// Your application code goes here
71+
```bash
72+
bun --preload ./instrument.js app.js
7873
```
7974

8075
## Step 3: Add Readable Stack Traces With Source Maps (Optional)

0 commit comments

Comments
 (0)