Skip to content
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

fix: Use POST for main process ping so it does not result in fetch breadcrumb #612

Merged
merged 2 commits into from
Jan 9, 2023

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Dec 30, 2022

While debugging e2e tests I noticed we still capture a breadcrumb for the ping IPC command.

      {
        timestamp: 1671415619.64,
        category: 'fetch',
        data: {
          method: 'GET',
          url: 'sentry-ipc://sentry-electron.ping/sentry_key',
          status_code: 200
        },
        type: 'http'
      }

This is because the @sentry/browser code that ignores urls with sentry_key in them only matches for POST requests.

@timfish timfish changed the title fix: Use POST for ping IPC so it does not result in fetch breadcrumb fix: Use POST for main process ping so it does not result in fetch breadcrumb Dec 30, 2022
@timfish timfish self-assigned this Dec 30, 2022
@@ -13,7 +13,7 @@ function getImplementation(): IPCInterface {

logger.log('IPC was not configured in preload script, falling back to custom protocol and fetch');

fetch(`${PROTOCOL_SCHEME}://${IPCChannel.PING}/sentry_key`).catch(() =>
fetch(`${PROTOCOL_SCHEME}://${IPCChannel.PING}/sentry_key`, { method: 'POST', body: '' }).catch(() =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought: Alternatively we could filter for this request in beforeBreadcrumb but I think this is also fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love integrations to have more hooks like for beforeBreadcrumb!

@timfish timfish merged commit ed784c3 into getsentry:master Jan 9, 2023
@timfish timfish deleted the fix/fetch-ipc-breadcrumbs branch January 9, 2023 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants