Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't open heroku application connecting to firebase

After Connecting to Firebase and add the following domain : Heroku Domain to the authorized domains, I get the following error when i try to [Heroku open]:

An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.


The logs are so confusing :

2017-10-15T19:43:14.249135+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=aqueous-lake-87719.herokuapp.com request_id=c837ed1c-0d44-497b-88d6-0cc72e062771 fwd="197.37.44.69" dyno= connect= service= status=503 bytes= protocol=http


My 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"
  },

My 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);
});

The Application on Github: React-Todo

like image 483
Anyname Donotcare Avatar asked Oct 15 '17 19:10

Anyname Donotcare


1 Answers

I deployed your app on heroku and found the same 503 error. Then i ran npm run build locally and realized it doesn't work. Because redux is missing. It may have worked for you as you may redux installed globally.

After adding

"redux": "^3.7.2",

To the package.json and pushing the app again, it works fine and I am able to access the app, though it has a JS error in initializing the Firebase connection, which you can fix easily

Firebase error

like image 82
Tarun Lalwani Avatar answered Oct 24 '22 06:10

Tarun Lalwani