Vanessa Flores
Vanessa Flores

Reputation: 115

firebase deploy gives a "path" error

After initiating my firebase app with

firebase init

I tried to deploy it with

firebase deploy

but I get this error

    === Deploying to 'fugis-auto-services-website'...

i  deploying database, storage, functions, hosting

Error: An unexpected error has occurred.

So I looked at the firebase-debug.log and this is what it says

Tue May 01 2018 19:52:19 GMT-0500 (CDT)
[debug] [2018-05-02T00:52:19.967Z] <<< HTTP RESPONSE 200
[info] 
[info] === Deploying to 'fugis-auto-services-website'...
[info] 
[info] i  deploying database, storage, functions, hosting
[debug] [2018-05-02T00:52:20.266Z] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at assertPath (path.js:39:11)
    at Object.join (path.js:1157:7)
    at Config.path (/Users/vanessaflores/.nvm/versions/node/v10.0.0/lib/node_modules/firebase-tools/lib/config.js:166:37)
    at /Users/vanessaflores/.nvm/versions/node/v10.0.0/lib/node_modules/firebase-tools/lib/deploy/lifecycleHooks.js:68:38
    at _chain (/Users/vanessaflores/.nvm/versions/node/v10.0.0/lib/node_modules/firebase-tools/lib/deploy/index.js:26:38)
    at /Users/vanessaflores/.nvm/versions/node/v10.0.0/lib/node_modules/firebase-tools/lib/deploy/index.js:29:14
    at process._tickCallback (internal/process/next_tick.js:178:7)
[error] 
[error] Error: An unexpected error has occurred.

I'm not sure how to proceed.

Upvotes: 11

Views: 5725

Answers (6)

Alejov
Alejov

Reputation: 529

I was using a firestore callback like onCreate or onUpdate without passing the actual document path.

functions.firestore
.document()
.onCreate()

Just turn it into

functions.firestore
.document('collection/doc')
.onCreate()

Upvotes: 0

Deo
Deo

Reputation: 59

Too late to answer but might help someone in future, I had the same issue, i added the public folder as mentioned by @Gleb and inside your firebase.json you need to specify the public folder as well, like so:

{
"hosting": {
"public": "public",
"rewrites": [
  {
    "source": "**",
    "function": "helloWorld"
  }
]
}
}

Upvotes: 4

Gleb Dolzikov
Gleb Dolzikov

Reputation: 834

Had same issue as i use hosting part just to setup headers, public property is necessary! If you not define it you would have this issue

Upvotes: 3

Rohat Sagar
Rohat Sagar

Reputation: 88

I was facing the same problem so after debugging for 2 hours I solved the problem by downgrading npm-conf to 1.1.0 with the command npm install [email protected]

Upvotes: 0

Vanessa Flores
Vanessa Flores

Reputation: 115

My problem ended up being that I updated my macOS to High Sierra 10.13.4 and that somehow screwed up my paths for nvm. I had to update nvm and I reinstalled Firebase and now things seem to be working.

Upvotes: 0

Justin
Justin

Reputation: 310

I was able to fix this by re-initializing firebase functions:

firebase init functions

You might want to first update your firebase-tools:

npm install -g firebase-tools

and backup your existing functions directory.

Upvotes: 3

Related Questions