Skip to content

Commit 2462336

Browse files
authored
fix(native): reference @sentry/wasm in the WASM guide (#14591)
## DESCRIBE YOUR PR The native guide for WebAssembly still explains that there is no official Sentry support for WASM crash reporting in the browser. This is no longer the case with the `@sentry/wasm` integration, and this PR updates the docs accordingly. Fixes getsentry/sentry-javascript#15420 ## 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) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
1 parent 4fa8261 commit 2462336

File tree

1 file changed

+3
-36
lines changed

1 file changed

+3
-36
lines changed

docs/platforms/native/guides/wasm/index.mdx

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -47,42 +47,9 @@ then needs to be uploaded to Sentry. For more information, see [Debug Informatio
4747

4848
## Crash Reporting
4949

50-
WebAssembly does not currently have a runtime that can produce stack traces. We
51-
do not yet provide a ready-to-use SDK, though we have a small integration for the
52-
Sentry JavaScript SDK to enhance error reports in the browser environment
53-
which include WASM frames, called [wasm-support.js](https://gist.github.com/mitsuhiko/c27fee8445d2a18a8c134e0169119058), which needs to be loaded _after_ the JavaScript SDK and before you start loading your WASM modules:
54-
55-
```html {tabTitle: CDN}
56-
<script
57-
src="https://browser.sentry-cdn.com/{{@inject packages.version('sentry.javascript.browser') }}/bundle.min.js"
58-
integrity="sha384-{{@inject packages.checksum('sentry.javascript.browser', 'bundle.min.js', 'sha384-base64') }}"
59-
crossorigin="anonymous"
60-
></script>
61-
<script src="wasm-support.js"></script>
62-
```
63-
64-
If you then throw a JavaScript exception you can get the stack trace. If you want
65-
to capture an error from within your WebAssembly application you can export a
66-
utility function like this:
67-
68-
```javascript
69-
function captureError() {
70-
try {
71-
throw new Error();
72-
} catch (e) {
73-
Sentry.captureException(e);
74-
}
75-
}
76-
77-
async function loadWasm(url) {
78-
const importObj = {
79-
env: {
80-
capture_error: captureError,
81-
},
82-
};
83-
return await WebAssembly.instantiateStreaming(fetch(url), importObj);
84-
}
85-
```
50+
If you want to have crash reporting in the browser, the recommended way with Sentry is to use
51+
the `@sentry/wasm` package and apply its `wasmIntegration` to your `@sentry/browser` configuration.
52+
This is [documented in detail](/platforms/javascript/guides/wasm/) in the JavaScript platform docs.
8653

8754
## Custom Crash Reports
8855

0 commit comments

Comments
 (0)