Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

737
Visualizações
Deploying on Heroku: Heroku gives me error 503 when app is deployed but app works on localhost

I'm trying to deploy a mern project for uni (already deplyoed react app on firebase) but my express/node.js rest api only works on localhost. I don't think the app even starts when deployed. Heroku gives me these errors:

Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command

and error 503 service unavailable in the network tab.


I tried heroku logs --tail and it said heroku[router]: at=error code=H10 desc="App crashed" method=GET ...


my Procfile:

web: node index.js

my package.json:

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "keywords": [
    "heroku"
  ],
  "engines": {
    "node": "16.x"
  },
  "author": "me",
  "license": "ISC",
  "dependencies": {
    "bcrypt": "^5.0.1",
    "express": "^4.17.1",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^6.0.14"
  }
}

PORT variable in index.js:

const PORT = process.env.PORT || 5000;
...
app.listen(PORT, () => console.log(`Server listening on port ${PORT}`));

I used Heroku CLI to deploy the app:

git init
git add .
git commit -am "initial commit"
heroku git:remote -a {project-name}
git push heroku master
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda