Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16420

Realtime Firebase Reconnection Issue in Chrome Extension

$
0
0

I am facing a persistent issue with my Chrome extension that uses Firebase for real-time data sync. The extension works fine on installation, but encounters problems reconnecting after network interruptions, restarts, or when the computer wakes from sleep. The error prompts in the manifest file suggest issues with Content Security Policy (CSP) related to script sources.

Here's a snippet of my current code in popup.js:

`const firebaseConfig = {apiKey: "--",authDomain: "--",projectId: "--",storageBucket: "--",messagingSenderId: "--",appId: "--",measurementId: "--",databaseURL: "--",};

firebase.initializeApp(firebaseConfig);

var db = firebase.database();`

I've noticed that the Firebase SDK which is in the same directory has built-in reconnection logic, but it doesn't seem to execute as expected. I receive CSP-related errors like:

Refused to load the script '<URL>' because it violates the following Content Security Policy directive: "script-src-elem 'self''unsafe-inline'".Refused to load the script '<URL>' because it violates the following Content Security Policy directive: "script-src 'self''wasm-unsafe-eval''inline-speculation-rules'<URL> <URL>". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

Please help

Manifest:

"content_scripts": [{"matches": [ "http://*/*","https://*/*" ],"js": ["scripts/lib/jquery-3.3.1.min.js","scripts/lib/jquery-ui.js","scripts/lib/popup.js","scripts/lib/firebase-compat.js""content_security_policy": {"extension_pages": "script-src 'self'; object-src 'self'; script-src-elem 'self''unsafe-inline';"  },

Viewing all articles
Browse latest Browse all 16420

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>