Troubleshooting and FAQs

Last updated:

|Edit this page

FAQs

How much does error tracking cost?

While in beta, error tracking is free. That means $exception events do not count as events towards your bill.

Are web workers supported?

Yes. Error tracking will work as long as you initialize PostHog in the web worker. You will need to disable any features that rely on the window object:

JavaScript
posthog.init(token, {
...
autocapture: false,
capture_pageview: false,
capture_pageleave: false,
disable_session_recording: true,
disable_surveys: true,
});

To identify users in web workers you will need to pass the distinct ID. This can be done via an env variable or sending it via postMessage from your main application.

Can exceptions be sampled / ignored

Returning null for a given event in the before_send hook will cause it not to be captured. You may want to:

  • Drop certain types of exceptions
  • Randomly sample a subset of all exceptions
  • Sample based on the events properties (e.g. URL or user)

Troubleshooting

What is a 'Script error.' with no stack traces?

For security purposes, errors sent from a JavaScript file served on a different domain hide the original error to avoid unintentionally leaking sensitive information to any onerror handler. This is often the case for third party scripts running on a site and results in an obfuscated 'Script error.' with no associated stack trace.

To see the actual error, the erroring script needs to be loaded anonymously which excludes potentially user-identifying information such as cookies from being transmitted when requesting the file.

<script src="https://third-party.domain/script.js" crossorigin="anonymous"></script>

It can be somewhat difficult to know which script is causing the error because the captured exception provides no context. There is no solution to this other than to work through a process of elimination.

If the script is within your control, you also need to set the Access-Control-Allow-Origin response header to include the calling domain. This can be a comma separated list of valid domains or a global wildcard e.g *.

Questions? Ask Max AI.

It's easier than reading through 604 docs articles.

Community questions

Was this page useful?