Using sentry while having an active baseURL #10128
Unanswered
ruudandriessen
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hey @ruudandriessen thanks for writing in! We have the RewriteFrames integration that is meant to be used for scenarios like this. I recommend you take a look at that!
What framework do you use for your URL? You might want to look at creating a custom routing instrumentation. export function customRoutingInstrumentation(
customStartTransaction,
startTransactionOnPageLoad,
startTransactionOnLocationChange,
): void {
if (startTransactionOnPageLoad) {
// make sure name is paramaterized (for ex. use /users/:id instead of /users/123)
const name = getBestTransactionName();
customStartTransaction({ op: 'pageload', name });
}
if (startTransactionOnLocationChange) {
// some example frontend router
frontendRouter.onPageChange(name => {
customStartTransaction({ op: 'navigation', name });
});
}
}
// later
Sentry.init({
dsn: '__PUBLIC_DSN__',
integrations: [
new Sentry.BrowserTracing({ routingInstrumentation: customRoutingInstrumentation }),
],
}); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using sentry when your application is not hosted on the root of the domain seems to require a lot of configuration out of the box to make it properly function.
For example, we are hosting our application on
domain.com/<organization>/<account>/projectName/....
However, this results in:
The only option it seems we have is overriding all url related properties in
beforeSend
andbeforeTransactionSend
.Is there no other way to handle this? i.e. by specifying a baseURL in a single spot that will automatically do this?
Beta Was this translation helpful? Give feedback.
All reactions