【问题标题】:Can't open heroku application connecting to firebase无法打开连接到 Firebase 的 Heroku 应用程序
【发布时间】:2018-03-27 07:51:38
【问题描述】:

连接到 Firebase 并添加以下域后: Heroku Domain 到授权域,当我尝试 [Heroku open] 时出现以下错误:

应用程序发生错误,您的页面无法访问 服务。如果您是应用程序所有者,请查看您的日志以了解详细信息。


日志太混乱了:

2017-10-15T19:43:14.249135+00:00 heroku[路由器]: at=error code=H10 desc="应用程序崩溃" 方法=GET path="/favicon.ico" 主机=aqueous-lake-87719.herokuapp.com request_id=c837ed1c-0d44-497b-88d6-0cc72e062771 fwd="197.37.44.69" dyno=连接=服务=状态=503字节=协议=http


我的 Package.json :

"name": "boilerplate",
  "version": "1.0.0",
  "description": "Simple react application",
  "main": "index.js",
  "scripts": {
    "test": "NODE_ENV=test karma start",
    "build": "webpack",
    "start": "npm run build && node server.js"
  },

我的 server.js :

var express = require('express');

// Create our app
var app = express();
const PORT = process.env.PORT || 3000;

app.use(function (req, res, next){
  if (req.headers['x-forwarded-proto'] === 'https') {
    res.redirect('http://' + req.hostname + req.url);
  } else {
    next();
  }
});

app.use(express.static('public'));

app.listen(PORT, function () {
  console.log('Express server is up on port ' + PORT);
});

Github 上的应用程序: React-Todo

【问题讨论】:

    标签: reactjs firebase heroku webpack firebase-authentication


    【解决方案1】:

    我在 heroku 上部署了您的应用,发现同样的 503 错误。然后我在本地运行npm run build 并意识到它不起作用。因为redux 不见了。它可能对您有用,因为您可能会在全局安装 redux

    添加后

    "redux": "^3.7.2",
    

    package.json 并再次推送应用程序,它工作正常,我能够访问该应用程序,尽管它在初始化 Firebase 连接时出现 JS 错误,您可以轻松修复

    【讨论】:

      猜你喜欢
      • 2013-06-16
      • 2013-11-30
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 2015-03-19
      • 2015-06-10
      • 2013-09-17
      相关资源
      最近更新 更多