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

@bugsnag/web-worker using cuid package which does not run in Web Workers #2017

Closed
rtymchyk opened this issue Sep 28, 2023 · 3 comments
Closed

Comments

@rtymchyk
Copy link

rtymchyk commented Sep 28, 2023

Describe the bug

Bugsnag for Web Workers appears to be using a fork of cuid package to generate IDs like for Session creation.

Inside cuid, navigator.mimeTypes is accessed like this (https://github.com/bugsnag/cuid/blob/662b859fea9f546dbbb6525d687558cd46a6518a/lib/fingerprint.browser.js#L8), which seems to fail in Web Worker.

Steps to reproduce

  1. Turn on session tracking
  2. Attempt to pause and resume session

Environment

  • Browser framework version (if any):
    • React: 7.19.0
    • Web Worker: 7.20.1
  • Browser version (e.g. chrome, safari): Safari
  • Device (e.g. iphonex): iOS
Error messages:
undefined is not an object (evaluating 'navigator.mimeTypes')
@mclack
Copy link
Contributor

mclack commented Sep 29, 2023

Hi @rtymchyk
Thanks for bringing this to our attention. We are looking into this, and will keep this thread updated with any developments.

@mclack mclack added the needs discussion Requires internal analysis/discussion label Sep 29, 2023
@mclack
Copy link
Contributor

mclack commented Oct 3, 2023

Hi @rtymchyk

We've looked into this, and can confirm we have a test that successfully sends a session:

Scenario: setting autoTrackSessions option to true
When I navigate to the test URL "/web_worker/auto_track_sessions"
And I wait to receive a session
Then the session is a valid browser payload for the session tracking API

navigator is also defined in web workers, so we would not expect this to be an issue: https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/navigator

We are unaware of any other users having this problem and I have also been unable to reproduce it. If you're still encountering this, are you able to elaborate on how you are pausing and resuming your sessions? As this is a public thread, please feel free to open a ticket with us by contacting support@bugsnag.com and reference this issue. To further aid our investigation, could you also please attach code snippets/screenshots of your BugSnag configuration and any session instrumentation you are performing.

@mclack mclack added awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks. and removed needs discussion Requires internal analysis/discussion labels Oct 3, 2023
@rtymchyk
Copy link
Author

rtymchyk commented Oct 4, 2023

Hi @rtymchyk

We've looked into this, and can confirm we have a test that successfully sends a session:

Scenario: setting autoTrackSessions option to true
When I navigate to the test URL "/web_worker/auto_track_sessions"
And I wait to receive a session
Then the session is a valid browser payload for the session tracking API

navigator is also defined in web workers, so we would not expect this to be an issue: https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/navigator

We are unaware of any other users having this problem and I have also been unable to reproduce it. If you're still encountering this, are you able to elaborate on how you are pausing and resuming your sessions? As this is a public thread, please feel free to open a ticket with us by contacting support@bugsnag.com and reference this issue. To further aid our investigation, could you also please attach code snippets/screenshots of your BugSnag configuration and any session instrumentation you are performing.

Thanks @mclack. I am not pausing/resuming sessions at all, just a simple Bugsnag.start({..}) in the global namespace, with an API key, release stage, and app version. I assumed it was session tracking related based on this:

Sessions are captured and reported by default. This behavior can be disabled using the autoTrackSessions configuration option.

But even with this config disabled, the issue persists.

I'll try to collect some more information and reach out via a ticket once I have it!

@rtymchyk rtymchyk closed this as completed Oct 4, 2023
@mclack mclack removed the awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks. label Oct 4, 2023
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

No branches or pull requests

2 participants