Skip to content

Move multiple origins page into source maps troubleshooting page #5786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/platform-includes/sourcemaps/upload/cli/javascript.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Upload Source Maps Using [`sentry-cli`](/product/cli/)

When using [`sentry-cli`](/product/cli/) to upload source maps, you need to set up your build system to both create a release and upload the various source files corresponding to that release. For Sentry to demangle your stack traces, provide both:

- The deployed files (in other words, the results of your transpilation/minification/bundling process; for example, `app.min.js`)
- The corresponding source maps

Expand Down Expand Up @@ -42,11 +43,10 @@ sentry-cli releases finalize <release_name>

For convenience, you can pass the `--finalize` flag to the `new` command, which will immediately finalize the release.


For more information, see our [`sentry-cli` docs](/product/cli/releases/#managing-release-artifacts).

<PlatformSection notSupported={["node"]} >

Its not uncommon for a web application to be accessible at multiple origins. See our documentation on [multiple origins](../../uploading/multiple-origins/) to learn how to handle this.
It's not uncommon for a web application to be accessible at multiple origins. See our documentation on <PlatformLink to="/sourcemaps/troubleshooting_js/#multiple-origins">multiple origins</PlatformLink> to learn how to handle this.

</PlatformSection>

This file was deleted.

26 changes: 26 additions & 0 deletions src/platforms/javascript/common/sourcemaps/troubleshooting_js.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,32 @@ The `~` is used in Sentry to replace the scheme and domain. It is not a glob!

but will NOT match `~/script.js`.

## Multiple Origins

It's not uncommon for a web application to be accessible at multiple origins. For example:

- Website is operable over both `https` and `http`
- Geolocated web addresses: such as `https://us.example.com`, `https://eu.example.com`
- Multiple static CDNs: such as `https://static1.example.com`, `https://static2.example.com`
- Customer-specific domains/subdomains

In this situation, **identical** JavaScript and source map files may be located at two or more distinct origins. In this situation we recommend using our special tilde (`~`) prefix on paths.

So for example, if you have the following:

- https://static1.example.com/js/app.js
- https://static2.example.com/js/app.js

You can upload using the URL of `~/js/app.js`. This will tell Sentry to ignore the domain and use the artifact for any origin.

Additionally you can also upload the same file under multiple names. Under the hood Sentry will deduplicate these.

<Note>

The ~ prefix tells Sentry that for a given URL, **any** combination of protocol and hostname whose path is `/js/app.js` should use this artifact. Use this method **only** if your source/source map files are identical at all possible protocol/hostname combinations. **Sentry will prioritize full URLs over tilde prefixed paths**, if found.

</Note>

## Verify artifact names match `sourceMappingURL` value

The `sourceMappingURL` comment on the last line of your bundled or minified JavaScript file tells Sentry (or the browser) where to locate the corresponding source map. This can either be a fully qualified URL, a relative path, or the filename itself. When uploading artifacts to Sentry, you must name your source map files with the value the file resolves to.
Expand Down

This file was deleted.

8 changes: 8 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,14 @@
{
"source": "/platforms/node/guides/connect/event-processors/",
"destination": "/platforms/node/enriching-events/event-processors/"
},
{
"source": "/platforms/javascript/sourcemaps/uploading/multiple-origins/",
"destination": "/platforms/javascript/sourcemaps/troubleshooting_js/#multiple-origins"
},
{
"source": "/platforms/javascript/guides/([^/]*)/sourcemaps/uploading/multiple-origins/",
"destination": "/platforms/javascript/guides/$1/sourcemaps/troubleshooting_js/#multiple-origins"
}
]
}