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

Logging errors to rollbar from service worker script in chrome extension with manifest v3 does not work #1040

Closed
tan-linx opened this issue Aug 4, 2022 · 5 comments

Comments

@tan-linx
Copy link

tan-linx commented Aug 4, 2022

Logging errors to rollbar from the service worker script within a chrome extension does not work.
Does anyone have the same issues regarding building a chrome extension with manifest v3 and has found a solution?

We investigated this issue but didn't get further. In manifest v3, instead of background pages, service workers are used which don't have access to the DOM. But it seems like rollbar still depends on the window global #141. The UMD version of Rollbar didn't fix this issue. Therefore it might also be related to updated security configurations?

@tan-linx tan-linx changed the title Logging errors to rollbar from servuc Logging errors to rollbar from serviceWorker script Aug 4, 2022
@tan-linx tan-linx changed the title Logging errors to rollbar from serviceWorker script Logging errors to rollbar from service worker script in chrome extension with manifest v3 Aug 4, 2022
@tan-linx tan-linx changed the title Logging errors to rollbar from service worker script in chrome extension with manifest v3 Logging errors to rollbar from service worker script in chrome extension with manifest v3 does not work Aug 4, 2022
@peter-unify
Copy link

I'm having similar problems:

  • the snippet included in the example doesn't work because it uses window like you've mentioned
  • the rollbar package from npm doesn't work either because the transport logic throws Error: No way to send a request.
No way to send a request
    at a (transport.js:120:21)
    at s (transport.js:91:18)
    at i.post (transport.js:62:3)
    at s.postItem (api.js:52:18)
    at o._makeApiRequest (queue.js:159:14)
    at o.addItem (queue.js:99:10)
    at o.<anonymous> (notifier.js:81:16)
    at s (notifier.js:111:7)
    at Array.itemToPayload (transforms.js:18:3)
    at s (notifier.js:115:16) undefined
telemetry.js:518 

@agendfuture
Copy link

As I understand for now is that rollbarjs uses XMLHttpRequest method which is not allowed in service worker scripts as of chrome manifest version 3. It should use new fetch API.

function _createXMLHTTPObject() {

@waltjones
Copy link
Contributor

Thank you for these reports. We're working on this and aiming to have a release by Nov 30.

@jccr
Copy link

jccr commented Nov 23, 2022

@waltjones That's great to hear, also ran into this blocker with our MV3 chrome extension.

In the meantime, others may be able to workaround this by using apple502j/xhr-shim to "polyfill" XHR back into your service worker.

@waltjones
Copy link
Contributor

This has been released now in v2.26.0.

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

5 participants