---
title: "Troubleshooting"
description: "If you need help solving issues with your Sentry JavaScript SDK integration, you can read the edge cases documented below."
url: https://docs.sentry.io/platforms/javascript/guides/connect/troubleshooting/
---

# Troubleshooting | Sentry for Connect

The SDK is not sending any data

If you set up the Sentry SDK and it's not sending any data to Sentry:

* Check that you have configured a DSN and that you are passing it to the `dsn` option in `Sentry.init()`.

  If you are using environment variables to pass the DSN, make sure the environment variables are set in all relevant environments. Additionally, if you are using environment variables inside a framework, check that the framework will include the environment variables in your bundle. Often this means you will have to prefix your environment variables with special prefixes defined by your framework (`NEXT_PUBLIC_` in Next.js, `NUXT_` in Nuxt, `VITE_` for Vite projects, `REACT_APP_` for Create React App, ...).

* Check that you have disabled any ad-blockers.

* Set `debug: true` in the `Sentry.init()` options and observe your console output when you start your application. The SDK may tell you why it is not sending any data.

* Check the [Stats](https://sentry.io/orgredirect/organizations/:orgslug/stats/) and [Subscription](https://sentry.io/orgredirect/organizations/:orgslug/settings/billing/overview/) pages in Sentry. You may have ran out of quota.

Updating to a new Sentry SDK version

If you update your Sentry SDK to a new major version, you might encounter breaking changes that need some adaption on your end. Check out our [migration guide](https://github.com/getsentry/sentry-javascript/blob/master/MIGRATION.md) to learn everything you need to know to get up and running again with the latest Sentry features.

Debugging additional data

You can view the JSON payload of an event to see how Sentry stores additional data in the event. The shape of the data may not exactly match the description.

For more details, see the [full documentation on Event Payload](https://develop.sentry.dev/sdk/foundations/transport/event-payloads/).

Max JSON payload size

By default, `maxValueLength` is undefined and nothing is truncated, but you can change this value according to your needs if your messages are longer (for example, to `250`). Please note that not every single value is affected by this option.

Error: 'import-in-the-middle' failed to wrap

When using ESM, by default all packages are wrapped under the hood by [import-in-the-middle](https://www.npmjs.com/package/import-in-the-middle). `import-in-the-middle` has compatibility issues with some packages and can throw errors in these situations.

Check out the [ESM Troubleshooting Instrumentation](https://docs.sentry.io/platforms/javascript/guides/connect/install/esm.md#troubleshooting-instrumentation) section for more information.

Third party promise libraries

When you include and configure Sentry, our JavaScript SDK automatically attaches global handlers to *capture* uncaught exceptions and unhandled promise rejections. You can disable this default behavior by changing the `onunhandledrejection` option to `false` in your GlobalHandlers integration and manually hook into each event handler, then call `Sentry.captureException` or `Sentry.captureMessage` directly.

You may also need to manage your configuration if you are using a third-party library to implement promises. Also, remember that browsers often implement security measures that can block error reporting when serving script files from different origins.

Events with 'Non-Error Exception'

If you’re seeing errors with the message “Non-Error exception (or promise rejection) captured with keys: x, y, z.”, this happens when you a) call `Sentry.captureException()` with a plain object, b) throw a plain object, or c) reject a promise with a plain object.

You can see the contents of the non-Error object in question in the `__serialized__` entry of the “Additional Data” section.

To get better insight into these error events, we recommend finding where the plain object is being passed or thrown to Sentry based on the contents of the `__serialized__` data, and then turning the plain object into an Error object.

Build errors with vite

If you're using the [Vite Bundler](https://vitejs.dev/) and a Sentry NPM package, and you see the following error:

```bash
Error: Could not resolve './{}.js' from node_modules/@sentry/utils/esm/index.js
```

This might be because the [`define`](https://vitejs.dev/config/shared-options.html#define) option in your Vite config is string-replacing some variable used by the Sentry SDK, like `global`, which causes build errors. Vite recommends using `define` for CONSTANTS only, and not putting `process` or `global` into the options. To fix this build error, remove or update your `define` option, as shown below:

`vite.config.ts`

```javascript
export default defineConfig({
   build: {
     sourcemap: 'hidden'
   },
-  define: {
-    global: {}
-  },
   plugins: [react()]
})
```

Missing module \`diagnostics\_channel\`

If you're getting build errors when using any of the JavaScript SDKs mentioning something along the lines of "Cannot find module diagnostics\_channel", try to configure your build tool to either externalize or ignore the `diagnostics_channel` module. The Sentry Node.js SDK uses this built-in module to instrument Node.js fetch requests. Some older Node.js versions do not have the `diagnostics_channel` API, which may lead to build errors when attempting to bundle your code.

Most bundlers have an option to externalize specific modules (like `diagnostics_channel`):

* [Externals in Webpack](https://webpack.js.org/configuration/externals/)
* [External in Vite](https://vitejs.dev/config/ssr-options.html#ssr-external)
* [External in esbuild](https://esbuild.github.io/api/#external)
* [External in Rollup](https://rollupjs.org/configuration-options/#external)

Terser plugin build errors

If you're using a custom webpack plugin that utilizes Terser or another minifier, you might encounter build errors due to a known webpack bug. This issue has been fixed in webpack version 5.85.1 and later.

For more details about this issue, see [webpack/terser-plugin build errors](https://github.com/getsentry/sentry-javascript/issues/14091).

pnpm: Resolving 'import-in-the-middle' external package errors

When using pnpm, you might encounter errors related to packages that can't be external, particularly with packages like `import-in-the-middle` and `require-in-the-middle`. These errors typically occur due to pnpm's strict dependency management and hoisting behavior.

While adding these packages as direct dependencies might remove the warning messages, it often doesn't resolve the underlying functionality issues:

```bash
pnpm add import-in-the-middle require-in-the-middle
```

As a workaround, create or modify `.npmrc` in your project root. First, try to specifically hoist the dependencies in question:

`.npmrc`

```ini
public-hoist-pattern[]=*import-in-the-middle*
public-hoist-pattern[]=*require-in-the-middle*
```

If that doesn't work, you can also tell pnpm to hoist all dependencies:

`.npmrc`

```ini
shamefully-hoist=true
```

**Note**: While `shamefully-hoist=true` usually isn't the ideal solution from a dependency management perspective, it's sometimes necessary for compatibility with certain packages that expect Node.js module resolution behavior similar to npm or yarn.

If you need additional help, you can [ask on GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose). Customers on a paid plan may also contact support.
