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

[BUG] Cannot track exception from service worker #1727

Closed
christopher-kiss opened this issue Dec 5, 2021 · 2 comments
Closed

[BUG] Cannot track exception from service worker #1727

christopher-kiss opened this issue Dec 5, 2021 · 2 comments
Assignees
Labels
bug released - NPM service-worker Required to properly support service workers
Milestone

Comments

@christopher-kiss
Copy link

Description/Screenshot
Service worker will fail to trackException because there is an unchecked window reference for getting the stack.
image

Steps to Reproduce
init app insights inside a service worker with following config:

{ config: { instrumentationKey: 'key here', disableXhr: true, disableFetchTracking: false } })

call trackException(new Error('error')) and flush()

  • OS/Browser: Windows 10 / Chrome 96
  • SDK Version [e.g. 22]: 2.7.1
  • How you initialized the SDK: new ApplicationInsights(snippet)

Expected behavior
Should be able to send track exception to app insights

Additional context
Add any other context about the problem here.
This error happens because we call window directly here:

} else if (window["opera"] && errorObj[strMessage]) {

This should most likely be getGlobalInst('opera') instead so that it safely bails out when window is not available.

@MSNev MSNev added bug service-worker Required to properly support service workers labels Dec 6, 2021
@MSNev MSNev self-assigned this Dec 6, 2021
@MSNev MSNev added this to the 2.7.2 milestone Dec 6, 2021
@MSNev MSNev added fixed - waiting release PR Committed and waiting deployment released - NPM waiting - CDN deployment and removed fixed - waiting release PR Committed and waiting deployment waiting - CDN deployment labels Dec 7, 2021
@MSNev
Copy link
Collaborator

MSNev commented Dec 8, 2021

Now fully released

@MSNev MSNev closed this as completed Dec 8, 2021
@github-actions
Copy link

github-actions bot commented Dec 9, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug released - NPM service-worker Required to properly support service workers
Projects
None yet
Development

No branches or pull requests

2 participants