JavaScript Troubleshooting

Errors aren't logged

If errors aren't logged from JavaScript, here's a list of things to try out:

  • Make sure that the log with the specified ID exists.
  • Make sure that the log isn't disabled and/or contains any ignore filters that could ignore client-side errors.
  • Make sure that the API key is valid and contains the Messages | Write permission.
  • Enable debugging when initializing to get additional debug and error messages from within the script printed to the browser console:

new Elmahio({
    apiKey: 'API_KEY',
    logId: 'LOG_ID',
    debug: true

  • If your webserver includes the Content-Security-Policy header make sure to include as an allowed domain.

Missing information on log messages

When logging uncaught errors with you get a lot of additional information stored as part of the log messages. Like the client IP and browser details. If you don't see this information on the messages logged from your application, it's probably because you are using the log function:

  title: 'This is a custom log message',
  severity: 'Error'

The log function only logs what you tell it to log. To include the additional information, switch to use the message builder:

var msg = logger.message(); // Get a prefilled message
msg.title = 'This is a custom log message';
msg.severity = 'Error';

Missing stack trace on errors

If errors logged through have a stack trace, it is logged as part of the error on If errors don't include a stack trace, the following actions may fix it:

  • Not all errors include a stack trace. Make sure that the thrown error does include a stack trace by inspecting:


  • Move the elmahio.js script import to the top of the list of all referenced JavaScript files.
  • Remove any defer or async attributes from the elmahio.js script import. The elmahio.js script import can include those attributes, but errors during initialization may not include stack trace or even be omitted if hasn't been loaded yet.

CORS problems when running on localhost

When running with on localhost you may see errors in the console like this:

Access to XMLHttpRequest at '' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Browsers like Chrome don't allow CORS when running locally. There are three ways to fix this:

  1. Run Chrome with the --disable-web-security switch.
  2. Run your website on a hostname like https://mymachine.
  3. Allow CORS on localhost with extensions like CORS Unblock for Chrome or Allow CORS: Access-Control-Allow-Origin for Firefox.

This article was brought to you by the team. is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening, and help you fix errors fast.

See how we can help you monitor your website for crashes Monitor your website