0
votes

I'm trying to set a target deploy for Firebase Functions. https://firebase.google.com/docs/cli/targets

This is the firebase.json file

{
  "functions": [{
    "target": "production",
    "source": "src/prod/functions",
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint",
      "npm --prefix \"$RESOURCE_DIR\" run build"
    ]
  }]
}

The predeploy runs normally but when deploying gets an error

functions[prod]: Finished running predeploy script.
Error: An unexpected error has occurred.

If I go to firebase-debug.log it shows:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

Putting the Functions folder on the project root it will deploy normally.

What is missing here?

1
The documentation states that "Firebase supports deploy targets for: Firebase Hosting sites, Cloud Storage for Firebase storage buckets, Firebase Realtime Database instances" - Renaud Tarnec

1 Answers

0
votes

Try running firebase init and set the options as best you can so it doesn't overwrite your existing project. I had to run it from the parent directory of /functions otherwise it will create a new directory but maybe there is some option to set a different directory name to suit your case.