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

How can we use this with service worker? #420

Closed
nikhiltech opened this issue Aug 12, 2021 · 3 comments · Fixed by #467
Closed

How can we use this with service worker? #420

nikhiltech opened this issue Aug 12, 2021 · 3 comments · Fixed by #467
Labels
question Further information is requested

Comments

@nikhiltech
Copy link

Summary

We are buiding a chrome extension, which will be active on any active browser tab. To send the events we need to register the amplitude with service worker. Putting Amplitude in popper won't be a complete solution for us. is there a way we can use it with service worker?

@nikhiltech nikhiltech added the question Further information is requested label Aug 12, 2021
@asalia-marine
Copy link

the above case pertains to the manifest v3 of chrome extensions, especially trying to load amplitude in background rather than popup or content scripts. In mv3, the background (persistent) script has been replaced by service worker.

The amplitude-js library fails to load and throws error 'ReferenceError: window is not defined'. which is understandable as service-worker doesn't have access to dom and dont have access to window global object. not sure if changing window to self will help.

@manwaring
Copy link

@nikhiltech were you able to figure out any sort of workaround? Running into this same issue...

@kevinpagtakhan kevinpagtakhan linked a pull request Dec 21, 2021 that will close this issue
6 tasks
@kevinpagtakhan
Copy link
Contributor

We just released v8.14.0 which includes support for web worker environments. We'd totally appreciate if you can provide any feedback on this new feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants