the issue does not solve my problem
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "~6.0.0",
"firebase-functions": "^2.1.0",
"node-fetch": "^2.3.0"
},
"private": true
}
node:
6.0
firebase-functions:
.onWrite
call .onwrite and tell me data updated or not
TypeError: Cannot read property 'match' of undefined
at resourceToInstanceAndPath (/user_code/node_modules/firebase-functions/lib/providers/database.js:170:25)
at RefBuilder.changeConstructor (/user_code/node_modules/firebase-functions/lib/providers/database.js:117:38)
at cloudFunctionNewSignature (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:104:28)
at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:135:20)
at /var/tmp/worker/worker.js:779:24
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
Yea
I found a few problems with this issue:
Hey @waqaramjad , thanks for reaching out with your issue. Could you add the full code for your database function to the original post? It will help us debug your issue. From the error logs you posted, it looks like you might not be passing a resource string to your functions.database.ref() call.
Example of onWrite usage:
exports.makeUppercase = functions.database.ref('/messages/{pushId}/original')
.onWrite((change, context) => { ... })
Problem resolved by changing npm version
this occurs on Node engine 8 and 10
How do you fix this issue if you are already using Node 8?
I updated all firebase packages to their latest versions and that cleared up my problem. I had a pretty out-of-date firebase-admin package that I believe was the issue.
Most helpful comment
How do you fix this issue if you are already using Node 8?