.map source map file to either your web server or through the elmah.io API. In this article, we go through each of the possibilities.
This is not a guide for generating source map files. There's a range of possibilities to help you do that (like
Publish to your web server
The easiest way for
.map reference at the end of the file causing the log message/error:
var v = 42; //# sourceMappingURL=/script.map
This will require you to serve a source map file named
script.map together with the minified/bundled file. The
.map file doesn't need to be publicly available over the internet, but the
De-minification from a
.mapfile doesn't work in older browsers (like < IE10).
Upload to elmah.io
.map file have been uploaded.
The code in the following sections will use the following bundled and minified stack trace as an example:
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)
To upload a source map to elmah.io you will need an API key with the Source Maps | Write permission enabled. We recommend creating a new API key with this permission enabled only. For more information about API keys and permissions, check out How to configure API key permissions.
Upload through the API
.map file. Both source map files should be uploaded to the elmah.io API.
For both bundled files, fill in the details as explained here:
|Path||This is the relative path to the bundled and minified file. For the example above you will need to specify
|SourceMap||The source map file representing the minified file in the
Upload from the elmah.io CLI
Source maps can be uploaded from the elmah.io CLI. Install the CLI if not already installed:
dotnet tool install --global Elmah.Io.Cli
Upload from PowerShell
Uploading source maps can be built into your CI/CD pipeline using cURL, PowerShell, or similar. Here's an example written in PowerShell:
Upload from C#
Source maps can be uploaded from C# using the
Elmah.Io.Client NuGet package:
Upload from Azure DevOps
- Go to the elmah.io Upload Source Map extension on the Azure DevOps Marketplace and click the Get it free button:
- Select your organization and click the Install button:
- Go to your Azure DevOps project and add the elmah.io Upload Source Map task. Fill in all fields as shown here:
Upload from GitHub Actions
Uploading one or more source maps from GitHub Actions is available using our integration with Actions. We recommend adding your API key and log ID as secrets on your GitHub repository, to avoid people outside of your organization getting access to those values.
To upload a generated source map from GitHub Actions, include the following in your build YAML file:
Upload from Octopus Deploy
Uploading one or more source from Octopus Deploy is available using our step template for Octopus. The step template can be installed in multiple ways as explained on Community step templates. In this document, the step template will be installed directly from the Process Editor:
Go to the Process Editor and click the ADD STEP button. In the Choose Step Template section search for 'elmah.io':
Hover over the 'elmah.io - Upload Source Map' community template and click the INSTALL AND ADD button.
In the Install and add modal click the SAVE button.
The step template is now added to the process. Fill in all fields as shown here:
This article was brought to you by the elmah.io team. elmah.io 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.