Firebase functions samples do not work - firebase

Recently found out what is Firebase and started studying it. I need Firebase functions for the server side of my project so I was trying to see how they work but unsuccessfully.
They have nice "little" collection of functions examples there. I tried to start few of them like image-maker but none of them worked for me. Image maker shows me this errors while serving the local server for it:
! functions: Failed to load functions source code. Ensure that you
have the latest SDK by running npm i --save firebase-functions inside
the functions directory.
! functions: Error from emulator.
FirebaseError: Error parsing triggers: Cannot find module
'canvas-prebuilt'
I have no idea what are they talking about. I installed everything by Firebase tutorial through firebase init.
I have:
npm -v: 5.5.1
node --version: v8.9.1
I don't know how to check for Firebase version but I guess I have the latest one since I have just installed it. How can I fix this problem and actually try the functions? Can these functions samples be outdated? Where can I find the better ones?

Related

Firebase errors in API after building and deploying same functions by different developers/computers

I am supporting the operation of a system that runs over Firebase, connects to Web, IoT and also iOS/Android flutter apps.
I am trying to add a new endpoint/function to my API, but after I do npm run build and npm run deploy it shows errors like below upon using one basic endpoint:
Error: Value for argument "seconds" is not a valid integer.
at Object.validateInteger (/workspace/node_modules/#google-cloud/firestore/build/src/validate.js:200:19)
at new Timestamp (/workspace/node_modules/#google-cloud/firestore/build/src/timestamp.js:70:20)
at Function.fromMillis (/workspace/node_modules/#google-cloud/firestore/build/src/timestamp.js:126:16)
at Function.fromDate (/workspace/node_modules/#google-cloud/firestore/build/src/timestamp.js:108:26)
at Bill.openBill (/workspace/lib/model/Bill.js:17:55)
at Object.fromFirestore (/workspace/lib/model/Bill.js:59:14)
at QueryDocumentSnapshot.data (/workspace/node_modules/#google-cloud/firestore/build/src/document.js:315:40)
at QueryDocumentSnapshot.data (/workspace/node_modules/#google-cloud/firestore/build/src/document.js:495:28)
at _admin.firestore.collection.doc.collection.get.then (/workspace/lib/controller/userController.js:535:71)
at process._tickCallback (internal/process/next_tick.js:68:7)
Another problem that showed up, after new deploy, was this one:
iot
TypeError: snapshot.data is not a function
at Object.fromFirestore (/workspace/lib/model/Bill.js:57:31)
at QueryDocumentSnapshot.data (/workspace/node_modules/#google-cloud/firestore/build/src/document.js:309:36)
at QueryDocumentSnapshot.data (/workspace/node_modules/#google-cloud/firestore/build/src/document.js:466:28)
at _admin.firestore.collection.doc.collection.get.then (/workspace/lib/controller/userController.js:535:71)
at process._tickCallback (internal/process/next_tick.js:68:7)
I haven't touched the code, to check if the problem was anything I could have changed and simply deployed again, with success but with the Type Error when calling a function that I never chaged the TS code!
For me, it seems that there is some kind of "package mismatch" between what the API should be using to deploy and what I it is really using from the build and deploy in my computer.
How can I know what's wrong with my API's deployment?
Can I build and deploy with same function version and older (or newer) packages without "breaking" their use online, as it happens now?

Suddenly can no longer deploy functions to Firebase project

using express app as function. my functions engines:node was set to 12. I had to upgrade node locally -- so I also updated engines:node to 16. suddenly couldn't deploy the functions, I reverted back to engines:node 12. Still can't deploy functions. Seeing this error:
Missing URI for HTTPS function in printTriggerUrls. This shouldn't happen
And a bunch of messages referring to previously deployed functions:
Could not find image for function
Extremely frustrated... tried reinstalling all the local npm packages with no luck.
The solution that finally worked was to delete all the previously deployed functions and re-deploy all the functions fresh.
Try running this command to see the logs
firebase functions:log

Firebase Functions are not working after deploying (MAC - OS)

Trying to deploy firebase functions..which deploys fine after giving warning on the first try
console warning:
Functions deploy had errors with the following functions:
To try redeploying those functions, run:
firebase deploy --only functions:
To continue deploying other features (such as database), run:
firebase deploy --except functions
redeploying does not give any error in console and functions deploys without any problem
but calling the function does not show any logs in firebase console, while giving this error in chrome console
Error: Forbidden
Your client does not have permission to get URL /sampleFunc from this server.
So I contacted firebase support and there seems to be an issue with functions:
here is what they replied:
There is an ongoing issue with the deployment of new functions as they are deployed as private, please update to the latest version 8.0.0 of the CLI with the command: npm install -g firebase-tools, which it might fix the error.
Our engineering team is already working to solve this issue, however there is no tell on when this fix will be released. At the moment the only workaround for this is to manually set a function to public using Cloud Console or gcloud CLI.
Let me know if you have more questions
Cheers,

how to solve to build ionic 3 with firebase issue

ran build without fail yesterday but suddenly firebase issue has occurred. what should i set for this issue?
i tried the following
cordova.system.library.4=com.google.firebase:firebase-core:16.0.9
cordova.system.library.5=com.google.firebase:firebase-messaging:18.0.0
cordova.system.library.6=com.google.firebase:firebase-config:17.0.0
cordova.system.library.7=com.google.firebase:firebase-perf:17.0.2
link:
https://firebase.google.com/support/release-notes/android#update_-_may_31_2019
but that shows that
What went wrong:
The library com.google.firebase:firebase-iid is being requested by various other libraries at [[18.0.0,18.0.0]], but resolves to 19.0.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
so i changed messaging version that
cordova.system.library.5=com.google.firebase:firebase-messaging:19.0.0
but also shows error
What went wrong:
Execution failed for task ':app:processDebugResources'.
Failed to execute aapt
ionic cordova build android
ionic cordova run android
I did what firebase shows me to do, but it hasn't been resolved.
thanks
Take a look at this thread: https://github.com/arnesson/cordova-plugin-firebase/issues/1081
In particular #dpa99c's comment
https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503135862
I was having the same problem since the Firebase support update (June 17, 2019) but running through those steps in #dpa99c's comment worked for me.
In addition to this, if you are building for iOS as well then you may need to update to the latest version and install pod inside your iOS platform folder if you haven't done so already.

Meteor instability

I am learning meteor to build an app. I am finding things pretty unstable with Meteor. I am using Ubuntu 14.04 and Meteor 1.0.3
Everything is working fine and I had finished couple of Modules. And Suddenly one day, I get this error:
Can't find npm module 'mailcomposer'. Did you forget to call 'Npm.depends' in package.js within the 'email' package?
I know that 'mailcomposer' package is not there and installed it and worked well.
And again, projects work fine and again one day suddenly I get this error:
Cannot find module 'fibers'.
I really want to know what is happening. I have not removed any module nor did I add one. My project was running fine, but later when I opened the system I got the error. Does meteor remove or update modules automatically in the backend? Rather than fixing these errors, I want to know why modules are suddenly being removed.
I am novice in Meteor, apologies if the question is stupid.
I had this issue when I was deploying an Meteor app on Digital Ocean, for some reason I had to reinstall nodejs and fibers package to make it work again.
Are you switching from 1 node version to another?
If you are on the server:
get meteor's node version meteor node -v
verify if the server is using the same node version by node -v
Let me know...

Resources