4
votes

I made a Chrome Extension and am using Firebase to authenticate users. I downloaded the Firebase.js from https://www.gstatic.com/firebasejs/4.11.0/firebase.js, hoping to add the firebase code to my chrome extension manifest. The Firebase auth is happening in a content script, so it needs to be included in the "js" under "content_scripts".

Manifest.json Content Script Example

Instead, I'm getting a UTF-8 error when putting firebase.js.

Error: Could not load file 'js/lib/firebase.js' for content script. It isn't UTF-8 encoded. Could not load manifest.

I tried using TextEdit on Mac to save the file as UTF-8 - still not luck.

What am I doing wrong?

1
Sounds like a bug in Chrome. See if you can reproduce it in an older portable Chrome or the new Chrome Canary. You can also search crbug.com and report this bug.wOxxOm
Same problem here with firebase.jsInfoStatus
it sounds a little stupid but could you downgrade to an inferior version of firebase, v2.2.1?Dani Grosu
I had the same problem with firebase v5.0.1, but after downgrading everything went just fineDani Grosu
2.2.1 but it may also work with a higher versionDani Grosu

1 Answers

0
votes

In my case, the issue stemmed from how minifiers/obfuscaters (e.g. uglify) encode certain characters. My development build worked fine, but I got this UTF8 error when I used a minified build.

Could not load file 'content-script.js' for content script. It isn't UTF-8 encoded.

For me, the solution was to disable minification.

It's an acceptable tradeoff because users aren't downloading the code from the server on every page load. It's only downloaded once when the extension is installed or updated. A little extra KB won't hurt anything.