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

Error thrown when using forceLongPolling with Chrome Extension Manifest V3 #8268

Open
ThabetIbrahim opened this issue May 26, 2024 · 4 comments

Comments

@ThabetIbrahim
Copy link

Operating System

maxOS 14.0

Browser Version

Chrome/125.0.6422.77

Firebase SDK Version

10.12.1

Firebase SDK Product:

Database

Describe your project's tooling

chrome extension, manifest v3, webpack

Describe the problem

The document is not defined when switching to using service workers.

ReferenceError: document is not defined
at executeWhenDOMReady
at BrowserPollConnection.open
at background.js

Steps and code to reproduce issue

The issue is reproducible on any extension that uses Manifest V3

@ThabetIbrahim ThabetIbrahim added new A new issue that hasn't be categoirzed as question, bug or feature request question labels May 26, 2024
@jbalidiong jbalidiong added api: database needs-attention and removed new A new issue that hasn't be categoirzed as question, bug or feature request labels May 27, 2024
@dlarocque
Copy link
Contributor

Hi, @ThabetIbrahim, I created a minimal Manifest v3 app with webpack and Firebase database and did not encounter the error you described.

To help me reproduce the issue, could you provide the following:

  • Webpack config
  • Manifest config
  • Code snippet that's causing the error
@ThabetIbrahim
Copy link
Author

Hi @dlarocque, thank you for your response. I have attached a sample CE to showcase the error.

I forgot to add to my report the error happens when I am trying to get a reference for the document. For example,

const mainFireStore = initializeApp(firebaseConfig);
const realTimeDB = getDatabase(mainFireStore); 

forceLongPolling(realTimeDB);
ref(realTimeDB, `accounts/1/1`); // ERR happens when trying to open the HTTP connection.

chrome-extensions-sample.zip

@dlarocque
Copy link
Contributor

Hi @dlarocque, thank you for your response. I have attached a sample CE to showcase the error.

I forgot to add to my report the error happens when I am trying to get a reference for the document. For example,

const mainFireStore = initializeApp(firebaseConfig);
const realTimeDB = getDatabase(mainFireStore); 

forceLongPolling(realTimeDB);
ref(realTimeDB, `accounts/1/1`); // ERR happens when trying to open the HTTP connection.

chrome-extensions-sample.zip

Thanks for the snippet, I was able to reproduce your issue!

@dlarocque
Copy link
Contributor

I was not able to reproduce this issue on a React application, so it may be specific to Chrome Manifest V3 applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants