Firebase-tools: firebase serve results in "Unexpected error occurred" for v4.1.x

Created on 17 Aug 2018  Â·  9Comments  Â·  Source: firebase/firebase-tools

Version info

> firebase --version
4.1.1

Platform Information

MacOS

Steps to reproduce

  1. Clone and setup https://github.com/dart-lang/site-www (see setup instructions in the README).
  2. Launch firebase serve using this script: ./scripts/serve.sh --firebase.
  3. Visit localhost:400.

Expected behavior

The visited page should load.
Note that it loads fine with [email protected].

Actual behavior

You'll see this in the browser: 'Unexpected error occurred.', and this in the terminal where the server was launched:

Error: {"redirect":""} is not a recognized responder directive
    at Responder._handle (/Users/chalin/.nvm/versions/node/v10.9.0/lib/node_modules/firebase-tools/node_modules/superstatic/lib/responder.js:72:22)
    at Responder.handle (/Users/chalin/.nvm/versions/node/v10.9.0/lib/node_modules/firebase-tools/node_modules/superstatic/lib/responder.js:43:15)
    at /Users/chalin/.nvm/versions/node/v10.9.0/lib/node_modules/firebase-tools/node_modules/superstatic/lib/middleware/files.js:59:36
    at tryCatch (/Users/chalin/.nvm/versions/node/v10.9.0/lib/node_modules/firebase-tools/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/Users/chalin/.nvm/versions/node/v10.9.0/lib/node_modules/firebase-tools/node_modules/rsvp/dist/rsvp.js:538:13)
    at publish (/Users/chalin/.nvm/versions/node/v10.9.0/lib/node_modules/firebase-tools/node_modules/rsvp/dist/rsvp.js:508:7)
    at flush (/Users/chalin/.nvm/versions/node/v10.9.0/lib/node_modules/firebase-tools/node_modules/rsvp/dist/rsvp.js:2415:5)
    at process._tickCallback (internal/process/next_tick.js:61:11)

The firebase config file is: https://github.com/dart-lang/site-www/blob/master/firebase.json.

Related:

cc @kwalrath @filiph @kevmoo @mbleigh

Most helpful comment

it's superstatic.js @ line 57 watching to remove trailing slash if its setting is false. Try to set "trailingSlash:true" in firebase.json for a temporary fix

All 9 comments

Getting this same issue with error {"redirect":""} is not a recognized responder directive also. Same behavior, the browser will print out: 'Unexpected error occurred.'

In my case, the only page that is failing is the index.html file, all other pages are loading properly.

Working with firebase 4.2.0 on Windows 10

it's superstatic.js @ line 57 watching to remove trailing slash if its setting is false. Try to set "trailingSlash:true" in firebase.json for a temporary fix

Thanks for pin-pointing that. Both firebase and superstatic have issues. I've reverted to earlier versions for both.

Hitting this issue as well.

@chalin Which versions did you downgrade to? Might be useful for others having the same issue (and who don’t want to change their trailingSlash settings).

@mathiasbynens, these versions:

    "firebase-tools": "4.0.3",
    "superstatic": "^5.0.2"

I can confirm [email protected] doesn’t have the firebase serve issue. However, it seems firebase deploy no longer works on v4.0.3. I keep getting:

âš   Your CLI authentication needs to be updated to take advantage of new features.
âš   Please run firebase login --reauth

Then, after doing the firebase login --reauth dance:

Error: An unexpected error has occurred.

Hopefully this can be fixed soon — I’d rather not have to choose between testing locally or deploying ;)

Maybe you can use superstatic for testing locally and firebase for deploying. (FYI, I can deploy locally without issues.)

To anyone experiencing this issue, just re-install npm i -g firebase-tools so it pulls in the latest superstatic as a dependency.

[email protected] was just released containing the fix (https://github.com/firebase/superstatic/pull/262).

Was this page helpful?
0 / 5 - 0 ratings