代码之家  ›  专栏  ›  技术社区  ›  Marcello Salomão

部署404错误时停止

  •  3
  • Marcello Salomão  · 技术社区  · 8 年前

    我很难弄清楚为什么每次尝试部署时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"
          } ]
      } ]
      }
    }
    
    1 回复  |  直到 8 年前
        1
  •  4
  •   Marcello Salomão    8 年前

    问题已解决。

    我不是百分之百确定,但我相信将firebase工具更新到最新版本并运行 firebase login --reauth 已修复错误。

    推荐文章