Whenever I run firebase serve on my mac I am getting a 404 error...This has never happened before and I was just using the local dev server maybe 5 minutes before this started happening. I have deleted the firebase.json file and reinitialized it, reinstalled firebase tools but it fails every time. Here are the results from running the command in debug mode.
firebase serve --debug
[2018-09-11T16:12:25.873Z] ----------------------------------------------------------------------
[2018-09-11T16:12:25.876Z] Command: /usr/local/bin/node /usr/local/bin/firebase serve --debug
[2018-09-11T16:12:25.877Z] CLI Version: 4.2.1
[2018-09-11T16:12:25.877Z] Platform: darwin
[2018-09-11T16:12:25.877Z] Node Version: v6.11.3
[2018-09-11T16:12:25.878Z] Time: Tue Sep 11 2018 11:12:25 GMT-0500 (CDT)
[2018-09-11T16:12:25.878Z] ----------------------------------------------------------------------
[2018-09-11T16:12:25.890Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2018-09-11T16:12:25.890Z] > authorizing via signed-in user
[2018-09-11T16:12:25.893Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/skadaddle-10f24
[2018-09-11T16:12:26.210Z] <<< HTTP RESPONSE 200 server=nginx, date=Tue, 11 Sep 2018 16:12:26 GMT, content-type=application/json; charset=utf-8, content-length=114, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-09-11T16:12:26.212Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/skadaddle-10f24
[2018-09-11T16:12:26.385Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Tue, 11 Sep 2018 16:12:26 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
=== Serving from '/Users/Kevin/Desktop/Source/Skadaddle'...
[2018-09-11T16:12:26.388Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/255074367563/clients/_:getWebAppConfig
[2018-09-11T16:12:26.514Z] <<< HTTP RESPONSE 404 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Tue, 11 Sep 2018 16:12:26 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
[2018-09-11T16:12:26.514Z] <<< HTTP RESPONSE BODY code=404, message=Requested entity was not found., status=NOT_FOUND
Error: HTTP Error: 404, Requested entity was not found.
[2018-09-11T16:12:26.519Z] Error Context: {
"body": {
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND"
}
},
"response": {
"statusCode": 404,
"body": {
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND"
}
},
"headers": {
"vary": "X-Origin, Referer, Origin,Accept-Encoding",
"content-type": "application/json; charset=UTF-8",
"date": "Tue, 11 Sep 2018 16:12:26 GMT",
"server": "ESF",
"cache-control": "private",
"x-xss-protection": "1; mode=block",
"x-frame-options": "SAMEORIGIN",
"x-content-type-options": "nosniff",
"alt-svc": "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"",
"accept-ranges": "none",
"connection": "close"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "mobilesdk-pa.googleapis.com",
"port": 443,
"hostname": "mobilesdk-pa.googleapis.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/v1/projects/255074367563/clients/_:getWebAppConfig",
"path": "/v1/projects/255074367563/clients/_:getWebAppConfig",
"href": "https://mobilesdk-pa.googleapis.com/v1/projects/255074367563/clients/_:getWebAppConfig"
},
"method": "GET"
}
}
}
The issue is with Google. When you run firebase serve
it makes a request to https://mobilesdk-pa.googleapis.com which is currently throwing a 404 error.
I was able to get around this (temporary fix) by editing 3 files in node_modules/firebase-tools/lib
.
On line 99 of api.js
is where the bad URL is being called. Simply change that to any valid non-404ing url.
Then, in fetchWebSetup.js
, change the parameter on line 9 after "GET"
to a blank string (e.g. return api.request("GET", "", {
Do that same as above to functionsConfig.js
on line 51.
This should get you up and running for now, but this should resolve itsself when Google fixes that URL.
Firebase employee here
There is a known problem with CLI deployment. It's being investigated. You can track the outage here:
https://status.firebase.google.com/incident/Hosting/18015
Whenever you experience a CLI failure like this, please contact Firebase support directly, with all the relevant details:
来源:https://stackoverflow.com/questions/52280478/firebase-serve-command-failing-with-error-404