My Nuxt app is hosted on Firebase. After I updated nuxt dependancy from 2.10.2 to 2.14.1 the live build crushes. The app works great locally, but when I deploy it using firebase deploy, I only see generic loading animation. In console there's only one message:
Uncaught SyntaxError: Unexpected token '<' in commons.ce964e3.js:1
I did try to delete node_modules directory along with package-lock.json and install dependancies again - it did not help.
I did have the same issue earlier on. What I did was: creating an app in Nuxt and trying to deploy. The error I had was:
Uncaught SyntaxError: Unexpected token '<' in commons.a599632.js:1
How I fixed it:
Edit firebase.json by removing /node_modules/ from the ignore line.
It should read something like:
"ignore": ["firebase.json", "**/.*"],
Related
I found this video How to add Firebase to a Service Worker - Chrome Extension Manifest Version MV3 created at 26 Jan 2021
Importing the files in the same way he did in the video I got the following error:
"SyntaxError: Unexpected token 'export'"
To try solve this I changed manifest.json to include "type"="module" (because firebase SDK version 9 uses es module)
"background": {
"service_worker": "firebase.js",
"type": "module"
},
And now the error is:
"importScripts() of new scripts after service worker installation is not allowed"
So I dowloaded to the extension https://www.gstatic.com/firebasejs/9.10.0/firebase-app.js to include Firebase static js files in the extension in a folder called firebase and try to import as follows.
import * as firebase from "../firebase/firebase-app.js";
...
firebase.initializeApp(firebaseConfig);
Also tried:
import { initializeApp } from "../firebase/firebase-app.js";
...
initializeApp(firebaseConfig);
But in both cases I get the following errors:
FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app).
DevTools failed to load source map: Could not load content for chrome-extension://hoopapahcqwsdaerotpablmamhgdbhga/firebase/firebase-app.js.map: System error: net::ERR_FILE_NOT_FOUND
Any advice?
I think I found the solution to the issue, at the end of firebase-app.js is the following:
//# sourceMappingURL=firebase-app.js.map
So I went to https://www.gstatic.com/firebasejs/9.10.0/firebase-app.js.map and copy its content in a file named firebase-app.js.map and place it in the same folder that firebase-app.js and now the code works ok.
Deploying our Firebase Function suddenly stopped working recently. Running firebase functions:log provided an insight that was not very helpful:
2022-02-15T06:53:12.421579Z E XXX:
{"#type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":3,"message":"Build
failed: curl: (22) The requested URL returned error: 404 \n\ngzip:
stdin: unexpected end of file\ntar: Child returned status 1\ntar:
Error is not recoverable: exiting now; Error ID:
08522105"},"authenticationInfo":{"principalEmail":"XXXX"},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction","resourceName":"XXXX"}
The deployment works fine for other projects, but fails even for older versions of this project (ones that have been deployed successfully in the past).
I received a 404 error from gcloud.functions.deploy on deploy:
Deploying function (may take a while - up to 2 minutes)...
.
For Cloud Build Stackdriver Logs, visit: https://console.cloud.google.com/logs/viewer?project=x-xxx-dev&advancedFilter=resource.type%3Dbuild%0Aresource.labels.build_id%3D35aac420-xx-4cd1-b7be-blah%0AlogName%3Dprojects%2Fxxx-xxx-dev%2Flogs%2Fcloudbuild
................failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: curl: (22) The requested URL returned error: 404
The root cause error is not visible here, but if you click on the Stackdriver logs link in the console output, there will be more details. In my case, the root error was that yarn 2.4.3 couldn't be downloaded # https://github.com/yarnpkg/yarn/releases/download/v2.4.3/yarn-v2.4.3.tar.gz
I did not expect to be using yarn 2 (berry) at this point, but in my package.json I was not explicit:
"engines": {
...
"yarn": ">=1.22.0"
},
By changing to accept only version 1, the problem was resolved:
"engines": {
...
"yarn": "^1.22.0"
},
I still don't understand why npm resolved this missing version.
The firebase log was not useful at all, but since Functions are built using "Google Cloud Build" I was able to get more insight into what's wrong by opening the Logs Explorer in Google Cloud Console. Select the resource type "Cloud Build" and there you will find logs of each build step and which one failed.
In this case, it fails to fetch the yarn-version specific in our package.json (1.22). Changing it to "1.22.17" (latest as of now) fixed the build.
"engines": {
"node": "14",
"npm": "8.1",
"yarn": "1.22.17"
},
I'm trying to use Google Cloud Text-to-Speech API in Meteor app, but get an error on the Meteor console and crash when trying to use the import function described in the instructions:
("Uncaught TypeError: Cannot convert undefined or null to object at Function.getPrototypeOf (<anonymous>)")
Here's what I've done (in app directory) before starting meteor:
meteor npm install google-tts-api
export GOOGLE_APPLICATION_CREDENTIALS="/data/authenticationinfo.json"
The problems are related to the inclusion of this line at the top of my js file:
import textToSpeech from '#google-cloud/text-to-speech';
This line cause the following Meteor startup error on the console:
"Unable to resolve some modules: "http2" in /app/node_modules/#grpc/grpc-js/build/src/channel.js (web.browser)
If you notice problems related to these missing modules, consider running:
meteor npm install --save meteor-node-stubs
Actually, I ran the above command, but it has no effect. When I run start the app, it crashes quickly with the error :
Uncaught TypeError: Cannot convert undefined or null to object
at Function.getPrototypeOf ()
at module.exports (modules.js?hash=59a3378abff937a73bf3a9865d654fce71b9583a:91277)
at index.js (modules.js?hash=59a3378abff937a73bf3a9865d654fce71b9583a:86991)
at fileEvaluate (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:346)
at Module.require (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:248)
at require (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:268)
at jwtclient.js (modules.js?hash=59a3378abff937a73bf3a9865d654fce71b9583a:79821)
at fileEvaluate (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:346)
at Module.require (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:248)
at require (modules-runtime.js?hash=b819d45cbf32aff410d740fac0364cb4088cd3f2:268)
I have tested it on a barebones node app, and my Google authentication json file works fine, so that's definitely not the problem.
I realize there are are some Meteor packages for Google TTS, but they're really old and use Google Translate (which won't work for long) instead of the new cloud services.
So, it turns out the import has to happen on the server side, NOT the client side.
I have configured electron with vuejs and i would like to add firebae to my project so i have
In my main.js
import * as firebase from 'firebase'
let firebasconfig = {
//config from firebase project
};
Vue.prototype.$firebase = firebase.initializeApp(firebasconfig);
But now am getting an error
Error: Failed to load gRPC binary module because it was not installed
for the current system
Expected directory: electron-v1.8-linux-x64-glibc
Found: [node-v59-linux-x64-glibc]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module
I have tried running rebuild but still fails
What elese do i need to do for this to work
I encouter the same issue with
vue-electron 1.0.6
firebase 5.4.2
vuefire 1.4.5
node 6.10.3
The following manipulation has worked for me. I have downgraded :
firebase to 4.6.0
vuefire to 1.4.4
Then ran npm rebuild and yarn and now it works.
I'm not sure all the things I have done are necessary. But for sure it looks like a problem with firebase.
I am new to firebase and am trying to make a simple app that utilizes user authentication. At this point in the project I am trying to run firebase on a local server using CLI commands.
I have set up firebase init and firebase deploy. When I type firebase serve on my project folder i get the response,
"an unexpected error has occurred".
Below i am attaching the contents of my firebase-debug.log file. Any help would be appreciated. Thanks
command requires scopes:
["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase",...
[debug] [2017-06-11T17:09:09.607Z] > authorizing via signed-in user
TypeError: Cannot read property 'public' of undefined
Look in your firebase.json file, which you should have in the directory where you're running firebase serve. It should look something like this:
{
"hosting": {
"public": "app",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
If it doesn't have that "hosting" key, then you'll get that Cannot read property 'public' of undefined error because firebase serve tries to access .hosting.public.
I faced this issue today, I ran it with --debug and found out that I've installed npm/node as sudo user, running following:
firebase serve
was giving me this error:
Error: An unexpected error has occurred.
When I ran it with sudo, I was able to deploy hosting and functions locally:
sudo firebase serve --debug --only hosting,functions
1) create a folder called "public" and put your files inside.
2) edit the firebase.json and just write this:
{
"hosting": {
"public": "public"
}
}
This appears to be a bug - that ideally should be resolved with Firebase Init. I have logged a support ticket with Firebase, and would encourage others to do so as well.
I think you may have skipped an initialization step by accident (I did the same thing on my first run-through)
Try this (from your same project directory):
1) firebase init
2) When prompted for which services you'll need make sure that Database AND Hosting options have their markers highlighted green (tab to Hosting with the spacebar). It's easy to select just database and let it run its configuration and assume it configures all of the bulleted options below it if you do not watch closely because the stdout info isn't very clear. Now hit Enter
3) Accept the default database settings as you probably did before, and when asked "What do you want to use as your public directory? (public)", hit Enter.
At this point you should be good to go spin up a local firebase web server...
4) try 'firebase serve', hit Enter, and you should get a verification that hosting files are being served from /public
Hope this helps. Good luck.
As for me the error is (--debug attr)
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/firebase-tools/node_modules/#google-cloud/functions-emulator/logs'
So the solution will be to run with sudo