Error Tracking troubleshooting

This page covers troubleshooting for Error Tracking. For setup, see the installation guides.

Have a question? Ask PostHog AI

Exceptions not appearing

If PostHog isn't capturing errors:

  1. Use the SDK Doctor to verify your SDKs are updated to the latest version

  2. Verify exception capture is enabled in project settings

  3. Only unhandled exceptions auto-capture. For caught errors, use posthog.captureException():

    JavaScript
    try {
    // code that errors
    } catch (error) {
    posthog.captureException(error)
    }
  4. Wait a few minutes and check Error Tracking in the PostHog app. Issues may take a few minutes to update after ingesting new error events

Source maps not resolving

If stack traces show minified code instead of original source:

  1. Verify source maps are uploaded to the correct project by navigating to Error Tracking and selecting Configure > Symbol sets. You'll also see warnings for missing symbol sets

  2. The release tag in your SDK config must match the version you uploaded:

    JavaScript
    posthog.init('<ph_project_api_key>', {
    ...
    session_recording: {
    recordCrossOriginIframes: true,
    },
    release: 'v1.2.3'
    })
  3. Source map paths must match your production bundle URLs exactly

  4. Upload source maps before deploying code that references them

See the source maps guide for upload instructions.

'Script error' with no stack trace

For security purposes, browsers hide error details from scripts loaded from different domains. This shows as Script error with no stack trace.

To fix, add crossorigin="anonymous" to your script tags:

HTML
<script src="https://your-cdn.com/app.js" crossorigin="anonymous"></script>

If the script is within your control, also set the Access-Control-Allow-Origin response header to your origin:

Access-Control-Allow-Origin: https://yourdomain.com

Or allow any origin:

Access-Control-Allow-Origin: *

You can also use session recordings to see what user actions triggered the error.

'Non-Error promise rejection' with no stack trace

This happens when you reject a promise with a string instead of an Error object. Without an Error object, there's no stack trace to capture.

new Promise((resolve, reject) => {
reject('Something went wrong'); // String has no stack trace
});
Promise.reject('Something went wrong');

For third-party libraries that reject with strings, wrap the rejection:

JavaScript
somePromise()
.catch(err => {
posthog.captureException(new Error(err))
throw err
})

'Minified React error' with no stack trace

In production builds, React removes debugging information to reduce bundle size. Errors look like:

Minified React error #123; visit https://reactjs.org/docs/error-decoder.html?invariant=123

To debug:

  1. Upload source maps to get readable stack traces. See the source maps guide
  2. Visit the error URL in the message to understand what went wrong
  3. Watch session recordings to see what user actions triggered the error, then reproduce in development
  4. Use a development build which includes full error messages. Only use this for debugging, not production

Solved community questions

Community questions

Was this page useful?

Questions about this page? or post a community question.