【问题标题】:Deploy stopping on 404 error部署在 404 错误时停止
【发布时间】:2018-01-16 17:15:46
【问题描述】:

我很难弄清楚为什么每次我尝试部署时 Firebase-CLI 都会输出此错误:

[debug] [2018-01-16T17:05:03.558Z] >>> HTTP REQUEST PUT https://firebaserules.googleapis.com/v1/projects/liberaakademio/releases/firebase.storage/liberaakademio.appspot.com { name: 'projects/liberaakademio/releases/firebase.storage/liberaakademio.appspot.com',
  rulesetName: 'projects/liberaakademio/rulesets/a082eaed-1fac-4661-a7ed-156e18e776e1' } 
 Tue Jan 16 2018 15:05:03 GMT-0200 (-02)
[debug] [2018-01-16T17:05:04.784Z] <<< HTTP RESPONSE 404
[debug] [2018-01-16T17:05:04.784Z] <<< HTTP RESPONSE BODY <!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 404 (Not Found)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>404.</b> <ins>That’s an error.</ins>
  <p>The requested URL <code>/v1/projects/liberaakademio/releases/firebase.storage/liberaakademio.appspot.com</code> was not found on this server.  <ins>That’s all we know.</ins>

[debug] [2018-01-16T17:05:04.786Z] TypeError: Cannot create property 'error' on string '<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 404 (Not Found)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>404.</b> <ins>That’s an error.</ins>
  <p>The requested URL <code>/v1/projects/liberaakademio/releases/firebase.storage/liberaakademio.appspot.com</code> was not found on this server.  <ins>That’s all we know.</ins>
'
    at module.exports (/usr/local/lib/node_modules/firebase-tools/lib/responseToError.js:11:16)
    at Request._callback (/usr/local/lib/node_modules/firebase-tools/lib/api.js:43:25)
    at Request.self.callback (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:186:22)
    at Request.emit (events.js:160:13)
    at Request.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1163:10)
    at Request.emit (events.js:160:13)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:255:19)
    at IncomingMessage.emit (events.js:165:20)
    at endReadableNT (_stream_readable.js:1101:12)
[error] 
[error] Error: An unexpected error has occurred.

我已经通过平台测试验证了我的规则文档,并且发布得很好。

我怀疑问题与我的 firebase.json 文件有关,目前看起来像这样:

{
  "firestore": {
    "rules": "firebaseRules/firestore.rules",
    "indexes": "firebaseRules/indexes.rules"
  },
  "storage": {
    "rules": "firebaseRules/storage.rules"
  },
  "hosting": {
    "public": "build",
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ],
    "headers": [ {
      "source" : "**",
      "headers" : [ {
        "key" : "Access-Control-Allow-Origin",
        "value" : "https://api.liberaakademio.com"
      } ]
  } ]
  }
}

【问题讨论】:

  • 如果您在部署时遇到问题并收到一条错误消息,但并不表明您做错了什么,您应该联系 Firebase 支持来解决问题。 Stack Overflow 上的人们可能无法提供太多帮助。 firebase.google.com/support/contact/troubleshooting
  • 嘿,@DougStevenson。幸运的是,我能够通过反复试验(有点)自己解决它。但这是个好建议。谢谢!

标签: firebase firebase-tools


【解决方案1】:

问题解决了。

我不是 100% 确定,但我相信将 firebase-tools 更新到最新版本并运行 firebase login --reauth 可以修复错误。

【讨论】:

  • 我遇到了同样的问题。在我的情况下,更新 firebase-tools 和 reauth 会导致显示一个新的错误消息,该消息在我的函数中发现了一个错误。泰!
  • 也许这个并在上传之前重建
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-12-09
  • 2019-03-31
  • 1970-01-01
  • 2015-01-21
  • 1970-01-01
  • 1970-01-01
  • 2013-06-09
相关资源
最近更新 更多