---
title: "WebAssembly"
description: "Learn about how Sentry processes WASM crash reports."
url: https://docs.sentry.io/platforms/native/guides/wasm/
---

# Sentry for WebAssembly

WebAssembly allows you to compile native code into a platform-independent bytecode format, which, for example, permits you to run native C, C++, or Rust code in a web browser.

**This feature is still developing, so may be rough around the edges.**

Debugging support for WebAssembly is an ongoing effort by the WebAssembly community. Support for it in Sentry is limited by what's possible in that ecosystem.

Want to be an early adopter, but running into issues? Please reach out to us [on GitHub](https://github.com/getsentry/symbolicator/issues/new/choose), we would love to talk.

## [Prerequisites](https://docs.sentry.io/platforms/native/guides/wasm.md#prerequisites)

You need:

* A Sentry [account](https://sentry.io/signup/) and [project](https://docs.sentry.io/product/projects.md)

## [Install](https://docs.sentry.io/platforms/native/guides/wasm.md#install)

To get crash reports with readable stack traces, your compiler must output [WASM DWARF debug information](https://yurydelendik.github.io/webassembly-dwarf/) alongside the binary code.

Sentry also requires debug information files to contain a `build_id` custom section. Our [wasm-split](https://github.com/getsentry/symbolicator/tree/master/crates/wasm-split) tool adds this section if it's missing and splits off the debug information, so it isn't sent to your users. Download a prebuilt `wasm-split` binary from the [Symbolicator releases](https://github.com/getsentry/symbolicator/releases/), or build it from source with a recent Rust compiler.

## [Configure](https://docs.sentry.io/platforms/native/guides/wasm.md#configure)

Sentry supports **Error Monitoring** for WebAssembly: it symbolicates WebAssembly frames in crash reports using the debug information files you upload. There's no Native SDK for WebAssembly, so Tracing, Logs, and Application Metrics aren't available through this guide. In the browser, the JavaScript SDK provides them.

### [Add a Build ID and Split Debug Information](https://docs.sentry.io/platforms/native/guides/wasm.md#add-a-build-id-and-split-debug-information)

Once your compiler has produced a `.wasm` file, use `wasm-split` to add a `build_id` (if missing) and split the file into a debug information file and a final stripped `.wasm` file without debug information:

```shell
wasm-split /path/to/file.wasm -d /path/to/file.debug.wasm --strip
```

This command modifies the `file.wasm` in place to add the `build_id`, then removes all debug information. The debug information is put in a `file.debug.wasm` file.

### [Upload Debug Information Files](https://docs.sentry.io/platforms/native/guides/wasm.md#upload-debug-information-files)

Upload `file.debug.wasm` to Sentry or make it available on a symbol server, as you would for other platforms. For more information, see [Debug Information Files](https://docs.sentry.io/platforms/native/guides/wasm/data-management/debug-files.md).

### [Report Crashes From the Browser](https://docs.sentry.io/platforms/native/guides/wasm.md#report-crashes-from-the-browser)

If you want crash reporting in the browser, use the `@sentry/wasm` package and add its `wasmIntegration` to your `@sentry/browser` configuration. This is [documented in detail](https://docs.sentry.io/platforms/javascript/guides/wasm.md) in the JavaScript platform docs.

### [Send Custom Crash Reports](https://docs.sentry.io/platforms/native/guides/wasm.md#send-custom-crash-reports)

If you don't run WebAssembly in a browser, but in your own runtime, you'll likely want to send custom crash reports. In that case, follow the general protocol documentation, which also covers how to describe WebAssembly frames: [stack trace interface](https://develop.sentry.dev/sdk/foundations/transport/event-payloads/stacktrace/).

Here is an example event for WebAssembly:

```javascript
{
  "platform": "native",
  "debug_meta": {
    "images": [
      {
        // the URL where the wasm file lives
        "code_file": "http://localhost:8002/demo.wasm",
        // indicates a web assembly module
        "type": "wasm",
        // the contents of the build_id section in hex,
        // truncated to 32 characters with a 0 appended
        "debug_id": "9e5cbc5553b44e8b9c69d18cdd7bfd2e0"
      }
    ]
  },
  "exception": {
    "values": [
      {
        "stacktrace": {
          "frames": [
            // wasm frame
            {
              "function": "wasm_func",
              "abs_path": "http://localhost:8002/demo.wasm",
              // the absolute offset in the wasm file for the instruction
              "instruction_addr": "0x8c",
              // indicates that the instruction_addr is relative to the 1st
              // module in the debug_info images list.
              "addr_mode": "rel:0"
            },
            // javascript frame
            {
              "function": "crash",
              "abs_path": "http://localhost:8002/index.html",
              "lineno": 24,
              "platform": "javascript"
            }
          ]
        },
        "type": "Error"
      }
    ]
  }
}
```

## [Verify Your Setup](https://docs.sentry.io/platforms/native/guides/wasm.md#verify-your-setup)

Trigger an error in a WebAssembly function, either in the browser with `wasmIntegration` enabled or by sending a custom crash report like the example above from your runtime.

### [View Captured Data in Sentry](https://docs.sentry.io/platforms/native/guides/wasm.md#view-captured-data-in-sentry)

Now, head over to the [Issues page](https://sentry.io/orgredirect/organizations/:orgslug/issues/) in your project to view the collected data (it takes a couple of moments for the data to appear). For more details, see the [Issue Details](https://docs.sentry.io/product/issues/issue-details.md) documentation.

## [Next Steps](https://docs.sentry.io/platforms/native/guides/wasm.md#next-steps)

At this point, you should be sending WebAssembly crash reports to Sentry. Here's what to explore next:

* Explore [practical guides](https://docs.sentry.io/get-started/guides.md) on what to monitor, log, track, and investigate after setup
* Learn how to [set up Sentry for WebAssembly in the browser](https://docs.sentry.io/platforms/javascript/guides/wasm.md)
* Learn more about [Debug Information Files](https://docs.sentry.io/platforms/native/guides/wasm/data-management/debug-files.md)

Are you having problems setting up the SDK or integration?

* Create a new issue [on GitHub](https://github.com/getsentry/symbolicator/issues/new/choose)
* [Get support](https://www.sentry.help/en/)

## Other Native Frameworks

- [Google Breakpad](https://docs.sentry.io/platforms/native/guides/breakpad.md)
- [Google Crashpad](https://docs.sentry.io/platforms/native/guides/crashpad.md)
- [Minidumps](https://docs.sentry.io/platforms/native/guides/minidumps.md)
- [Qt](https://docs.sentry.io/platforms/native/guides/qt.md)

## Topics

- [Data Management](https://docs.sentry.io/platforms/native/guides/wasm/data-management.md)
- [Security Policy Reporting](https://docs.sentry.io/platforms/native/guides/wasm/security-policy-reporting.md)
- [Debug Information](https://docs.sentry.io/platforms/native/guides/wasm/debug-information.md)

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
