-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Example event: https://sentry.io/organizations/project-wren/issues/2399314422/events/85d536082ab64b56bf22835c708d986f/
Package + Version
-
@sentry/browser: "^1.4.9", -
@sentry/node: "^6.3.5" -
@sentry/tracing: ""^6.3.5"" -
raven-js -
raven-node(raven for node) - other:
Version:
1.4.9
Description
It seems like the sentry-trace header is not being sent in fetch requests that we send from our app's frontend. We construct our requests this way:
function generateHeaders() {
const headers = new Headers({
'Content-Type': 'application/json',
});
const token = getSessionToken();
if (token) {
headers.set('Authorization', `Bearer ${token}`);
}
// another internal header not relevant,
headers.set('...', 'something');
return headers;
}
async function post(endpoint, body) {
const request = new Request(`${API_URL}/${endpoint}`, {
method: 'POST',
headers: generateHeaders(),
body: JSON.stringify(body),
});
const response = await fetch(request);
if (contentType && contentType.includes('application/json')) {
const responseBody = await response.json();
return [response, responseBody];
}
return [response, null];
}We aren't seeing any distributed tracing for our backend service for requests being initiated this way, and the sentry header is not present:
Our Sentry init:
Sentry.init({
dsn: '...'
integrations: [
new Integrations.BrowserTracing(),
new SentryFullStory('project-wren'),
],
environment: getReleaseStageFromURL(),
release: window.appVersion,
tracingOrigins: ['localhost', 'wren.co'],
ignoreErrors: [
'disguiseToken',
'cancelled',
'Illegal invocation',
'Failed to load Stripe.js',
'Non-Error promise rejection captured',
'chunk',
],
beforeSend(event) {
const user = getStore().getState().user;
if (event.exception) {
Sentry.showReportDialog({
eventId: event.event_id,
user: {
name: user.firstName,
email: user.email,
},
});
}
return event;
},
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 0.5,
});Metadata
Metadata
Assignees
Labels
No labels
