Firebase-functions: Cannot read property 'match' of undefined

Created on 23 Feb 2019  路  6Comments  路  Source: firebase/firebase-functions

Related issues

the issue does not solve my problem

[REQUIRED] Version info

{
  "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

[REQUIRED] Expected behavior

call .onwrite and tell me data updated or not

[REQUIRED] Actual behavior

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)

Were you able to successfully deploy your functions?

Yea

Attention

Most helpful comment

How do you fix this issue if you are already using Node 8?

All 6 comments

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

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.

Was this page helpful?
0 / 5 - 0 ratings