Firebase-tools: Improve error messaging when missing "public" directory

Created on 16 Dec 2015  路  11Comments  路  Source: firebase/firebase-tools

After logging in, running firebase deploy fails with the following log:

[debug] ----------------------------------------------------------------------
[debug] Command:      node C:\Users\mckinnonzw\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase deploy
[debug] Platform:     win32
[debug] Node Version: v0.12.7
[debug] Time:         Wed Dec 16 2015 15:34:56 GMT-0600 (Central Standard Time)
[debug] ----------------------------------------------------------------------
[debug] 
[debug] >>> HTTP REQUEST GET https://admin.firebase.com/firebase/future150/token?token=XXX 
[debug] <<< HTTP RESPONSE 200
[debug] >>> HTTP REQUEST GET https://admin.firebase.com/firebase/future150/token?token=XXX 
[debug] <<< HTTP RESPONSE 200
[info] 
[info] === Deploying to 'future150'...
[info] 
[info] i  deploying 
[debug] >>> HTTP REQUEST POST https://deploy.firebase.com/firebase/future150/releases?token=XXX
[debug] TypeError: Cannot read property 'error' of undefined
    at Request._callback (C:\Users\mckinnonzw\AppData\Roaming\npm\node_modules\firebase-tools\lib\api.js:31:22)
    at Request.self.callback (C:\Users\mckinnonzw\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\request.js:198:22)
    at Request.emit (events.js:110:17)
    at Request.<anonymous> (C:\Users\mckinnonzw\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\request.js:1035:10)
    at Request.emit (events.js:129:20)
    at IncomingMessage.<anonymous> (C:\Users\mckinnonzw\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\request.js:962:12)
    at IncomingMessage.emit (events.js:129:20)
    at _stream_readable.js:908:16
    at process._tickCallback (node.js:355:11)
[error] 
[error] Error: An unexpected error has occurred.
hosting polish feature request

Most helpful comment

Fixed by add "public": "." 馃幆

All 11 comments

Can you try upgrading your CLI version with npm install -g firebase-tools (should be 2.2.0) and running again?

firebase --version is 2.2.0

The command line result is:

=== Deploying to 'future150'...

i  deploying

Error: An unexpected error has occurred.

I am not sure what is happening here, but, at the very least, I would expect a more descriptive error message.

Can you paste your firebase.json contents? Are you able to run other commands (like firebase list) ok?

firebase list works nicely.

{
  "firebase": "future150",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**",
    "bower.json",
    "CNAME",
    "gulpfile.js",
    "karma.conf.js",
    "package.json",
    "README.md"
  ]
}

I just realized the solution . . .

"public" is a required property. I saw "The default value is the project's root directory." in the documentation and assumed it was not required. It DOES say "Required".

Definitely my fault.

Please close.

Although, it might be helpful to give an error message that tells why it is failing. Maybe the next person won't run into this problem.

One of my teammates also experienced this issue with public set to an empty string (assuming it would mean root).

{
  "firebase": "foo",
  "public": "",
  "ignore": [
    "firebase.json"
  ]
}

@jeffbcross - To get root (by which I assume you mean the root of your project), you'd want to do "." (aka, the same directory at which the firebase.json lives).

@zmckinnon - Thanks for tracking down this issue. I think that although it was in a way user error, we should provide a better error message for when the "public" key is not provided. I'm going to leave this issue open so we can address it.

Yep, this error message is super cryptic.

Fixed by add "public": "." 馃幆

having the same issue, when running firebase serve the log says the same, how to fix

Was this page helpful?
0 / 5 - 0 ratings