Server-side source map support on elmah.io

It just struck me that we didn't really announce a major new improvement on elmah.io besides on the Changelog: Server-side JavaScript source map support. Stay tuned to learn more about this feature and why you'd need it.

Server-side source map support on elmah.io

While elmah.io started as a cloud-logging and error monitoring platform for .NET, we expanded to also cover JavaScript a few years ago. Being able to log errors from both the client and the server to the same error monitoring platform just makes a lot of sense.

If you ever worked with JavaScript, you know all about the common practice of bundling and minification. Both tactics speed up loading of JavaScript files from the server to the client. The downside of bundling and minifying files is that stack traces are somewhat unreadable:

Error: You cannot copy to the clipboard
    at window.copyTextToClipboard (https://foo.bar/bundles/sharedbundle.min.js:69:24978)
    at MyViewModel.n.copy (https://foo.bar/bundles/viewmodels.min.js:37:37385)
    at HTMLButtonElement.<anonymous> (https://foo.bar/bundles/sharedbundle.min.js:55:109467)

JavaScript source maps fix this by providing a translation mechanism between bundled and minified stack traces and the original source file. Our integration with JavaScript, elmah.io.javascript, automatically looks for a source map and does the translation before even sending the error to elmah.io.

But what if you for some reason cannot publish the source map file to the webserver? Common reasons for this are:

  1. You don't want to let people reverse engineer your JavaScript (at least not that easily).
  2. You publish your code inside a wrapper to run as an app on a mobile phone and want to keep the package size as small as possible.

There are probably other reasons too. With server-side source map support, we provide a way for you to upload your source map to elmah.io through the API. This way, your source map won't be public or included in your build output. Once elmah.io receives a bundled and minified stack trace, we automatically try to de-minify it using an uploaded source map.

Uploading source maps is easy either manually on the Swagger UI page, through an HTTPS call, or through one of our integrations. We currently support integrations for Azure DevOps, GitHub Actions, and Octopus Deploy. But anything able of invoking the upload source map endpoint can upload a source map to elmah.io.

Check out the documentation for more details about how this works and how to configure an upload as part of your deployment pipeline: https://docs.elmah.io/sourcemaps/.

elmah.io: Error logging and Uptime Monitoring for your web apps

This blog post is brought to you by elmah.io. elmah.io is error logging, uptime monitoring, deployment tracking, and service heartbeats for your .NET and JavaScript applications. Stop relying on your users to notify you when something is wrong or dig through hundreds of megabytes of log files spread across servers. With elmah.io, we store all of your log messages, notify you through popular channels like email, Slack, and Microsoft Teams, and help you fix errors fast.

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