I've got an app where the frontend is deployed to Netlify and the Strapi backend is deployed to Heroku. I recently upgraded Strapi from v3.0.6 to v3.1.3. I was previously using PostgresQL in production, so along with the Strapi upgrade I also am attempting to move over to MongoDB.
I'm attempting to deploy my backend to production, however I keep receiving a 503 error and the app crashes. You can see from the error logs below that there is an issue connecting to the Mongo database.
Here are my relevant logs from Heroku:
2020-08-06T15:06:49.848463+00:00 app[web.1]: > backend#0.1.0 start /app
2020-08-06T15:06:49.848464+00:00 app[web.1]: > strapi start
2020-08-06T15:06:49.848465+00:00 app[web.1]:
2020-08-06T15:06:52.238840+00:00 app[web.1]: (node:23) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2020-08-06T15:06:52.238869+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2020-08-06T15:06:52.239130+00:00 app[web.1]: (node:23) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2020-08-06T15:06:52.239199+00:00 app[web.1]: (node:23) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2020-08-06T15:06:52.239276+00:00 app[web.1]: (node:23) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2020-08-06T15:07:10.279519+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=<app-name>.herokuapp.com request_id=9e81f113-1003-42f7-82e7-59296dc1f0f8 fwd="24.19.220.31" dyno= connect= service= status=503 bytes= protocol=https
2020-08-06T15:07:22.242572+00:00 app[web.1]: [2020-08-06T15:07:22.241Z] debug ⛔️ Server wasn't able to start properly.
2020-08-06T15:07:22.243944+00:00 app[web.1]: [2020-08-06T15:07:22.243Z] error Error connecting to the Mongo database. Server selection timed out after 30000 ms
2020-08-06T15:07:22.266318+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-06T15:07:22.266611+00:00 app[web.1]: npm ERR! errno 1
2020-08-06T15:07:22.269156+00:00 app[web.1]: npm ERR! backend#0.1.0 start: `strapi start`
2020-08-06T15:07:22.269330+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-06T15:07:22.269513+00:00 app[web.1]: npm ERR!
2020-08-06T15:07:22.269976+00:00 app[web.1]: npm ERR! Failed at the backend#0.1.0 start script.
2020-08-06T15:07:22.270129+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-06T15:07:22.278069+00:00 app[web.1]:
2020-08-06T15:07:22.278314+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-06T15:07:22.278417+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-06T15_07_22_271Z-debug.log
2020-08-06T15:07:22.355748+00:00 heroku[web.1]: Process exited with status 1
2020-08-06T15:07:22.394507+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-06T15:07:23.802505+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=<app-name>.herokuapp.com request_id=f5876daf-f945-46b8-88c0-08a61106cfc5 fwd="24.19.220.31" dyno= connect= service= status=503 bytes= protocol=https
I've got the Mongo URI env variable set in Heroku and the app runs fine locally. I'm using Mongo Atlas in the free tier, so I'm wondering if that has something to do with it? Does anyone have any ideas what could be the issue?
I spent 24 hours attempting to fix it before making this post, and just like that - a half hour after making this post - I fixed it, thanks to this SO answer. I needed to whitelist the IP address in order to allow the connection between MongoDB and Heroku!
Related
Guys i'm trying to make a hosting for my backend app, and this is the second time i do it, the problem is that, i have this error
And, i tried to log my app so i can see where is the error, and this appears
2021-03-21T18:22:21.067459+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:22:25.290401+00:00 app[web.1]:
2021-03-21T18:22:25.290415+00:00 app[web.1]: > server#1.0.0 start /app
2021-03-21T18:22:25.290416+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:22:25.290416+00:00 app[web.1]:
2021-03-21T18:22:25.316554+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:22:25.362375+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:22:25.363310+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:22:25.364814+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:22:25.365654+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:22:25.388201+00:00 app[web.1]: npm ERR! server#1.0.0 start: `nodemon index.js`
2021-03-21T18:22:25.388571+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:22:25.389012+00:00 app[web.1]: npm ERR!
2021-03-21T18:22:25.389281+00:00 app[web.1]: npm ERR! Failed at the
server#1.0.0 start script.
2021-03-21T18:22:25.389521+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:22:25.400950+00:00 app[web.1]:
2021-03-21T18:22:25.401357+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:22:25.401620+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_22_25_390Z-debug.log
2021-03-21T18:22:25.500796+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:22:25.573335+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:22:25.576936+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-21T18:22:28.365986+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:22:30.896431+00:00 app[web.1]:
2021-03-21T18:22:30.896468+00:00 app[web.1]: > server#1.0.0 start /app
2021-03-21T18:22:30.896468+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:22:30.896468+00:00 app[web.1]:
2021-03-21T18:22:30.907038+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:22:30.919190+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:22:30.919692+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:22:30.919949+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:22:30.920239+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:22:30.927062+00:00 app[web.1]: npm ERR! server#1.0.0 start: `nodemon index.js`
2021-03-21T18:22:30.927284+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:22:30.927492+00:00 app[web.1]: npm ERR!
2021-03-21T18:22:30.927684+00:00 app[web.1]: npm ERR! Failed at the
server#1.0.0 start script.
2021-03-21T18:22:30.927851+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:22:30.963521+00:00 app[web.1]:
2021-03-21T18:22:30.963855+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:22:30.964051+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_22_30_928Z-debug.log
2021-03-21T18:22:31.015557+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:22:31.101810+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:22:44.381282+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=836abccf-8d2c-432d-a50f-53810887e9ad fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:22:48.388632+00:00 heroku[router]: at=error code=H10 d
PS C:\Users\diego cifuentes\Desktop\Portafolio\Fullstack Projects\Daily App - MERN\server> heroku restartRestarting dynos on ⬢ daily-mern... done
PS C:\Users\diego cifuentes\Desktop\Portafolio\Fullstack Projects\Daily App - MERN\server> heroku logs --tail --app daily-mern
2021-03-21T18:15:05.905941+00:00 app[api]: Initial release by user diegodarkusgamer24#gmail.com
2021-03-21T18:15:05.905941+00:00 app[api]: Release v1 created by user diegodarkusgamer24#gmail.com
2021-03-21T18:15:06.053078+00:00 app[api]: Release v2 created by user diegodarkusgamer24#gmail.com
2021-03-21T18:15:06.053078+00:00 app[api]: Enable Logplex by user diegodarkusgamer24#gmail.com
2021-03-21T18:21:59.000000+00:00 app[api]: Build started by user diegodarkusgamer24#gmail.com
2021-03-21T18:22:16.855697+00:00 app[api]: Deploy 81dac1f3 by user diegodarkusgamer24#gmail.com
2021-03-21T18:22:16.855697+00:00 app[api]: Release v3 created by user diegodarkusgamer24#gmail.com
2021-03-21T18:22:16.875164+00:00 app[api]: Scaled to web#1:Free by user diegodarkusgamer24#gmail.com
2021-03-21T18:22:17.000000+00:00 app[api]: Build succeeded
2021-03-21T18:22:21.067459+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:22:25.290401+00:00 app[web.1]:
2021-03-21T18:22:25.290415+00:00 app[web.1]: > server#1.0.0 start /app
2021-03-21T18:22:25.290416+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:22:25.290416+00:00 app[web.1]:
2021-03-21T18:22:25.316554+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:22:25.362375+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:22:25.363310+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:22:25.364814+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:22:25.365654+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:22:25.388201+00:00 app[web.1]: npm ERR! server#1.0.0 start: `nodemon index.js`
2021-03-21T18:22:25.388571+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:22:25.389012+00:00 app[web.1]: npm ERR!
2021-03-21T18:22:25.389281+00:00 app[web.1]: npm ERR! Failed at the
server#1.0.0 start script.
2021-03-21T18:22:25.389521+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:22:25.400950+00:00 app[web.1]:
2021-03-21T18:22:25.401357+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:22:25.401620+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_22_25_390Z-debug.log
2021-03-21T18:22:25.500796+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:22:25.573335+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:22:25.576936+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-21T18:22:28.365986+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:22:30.896431+00:00 app[web.1]:
2021-03-21T18:22:30.896468+00:00 app[web.1]: > server#1.0.0 start /app
2021-03-21T18:22:30.896468+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:22:30.896468+00:00 app[web.1]:
2021-03-21T18:22:30.907038+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:22:30.919190+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:22:30.919692+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:22:30.919949+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:22:30.920239+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:22:30.927062+00:00 app[web.1]: npm ERR! server#1.0.0 start: `nodemon index.js`
2021-03-21T18:22:30.927284+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:22:30.927492+00:00 app[web.1]: npm ERR!
2021-03-21T18:22:30.927684+00:00 app[web.1]: npm ERR! Failed at the
server#1.0.0 start script.
2021-03-21T18:22:30.927851+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:22:30.963521+00:00 app[web.1]:
2021-03-21T18:22:30.963855+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:22:30.964051+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_22_30_928Z-debug.log
2021-03-21T18:22:31.015557+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:22:31.101810+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:22:44.381282+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=836abccf-8d2c-432d-a50f-53810887e9ad fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:22:48.388632+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=daily-mern.herokuapp.com request_id=4872869b-653b-411c-8041-6c74f2c933d1 fwd="177.254.11.56" dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:23:28.033455+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=938148d2-e2b9-44ec-b0e3-7c36a15c30bb fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:23:32.633910+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=daily-mern.herokuapp.com request_id=12ce541f-e48b-43f0-895f-4987388d0918 fwd="177.254.11.56" dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:33:27.499912+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-21T18:33:30.454323+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:33:33.252960+00:00 app[web.1]:
2021-03-21T18:33:33.252982+00:00 app[web.1]: > server#1.0.0 start /app
2021-03-21T18:33:33.252982+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:33:33.252983+00:00 app[web.1]:
2021-03-21T18:33:33.265627+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:33:33.280021+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:33:33.280574+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:33:33.280907+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:33:33.281222+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:33:33.289740+00:00 app[web.1]: npm ERR! server#1.0.0 start: `nodemon index.js`
2021-03-21T18:33:33.290008+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:33:33.290328+00:00 app[web.1]: npm ERR!
2021-03-21T18:33:33.290552+00:00 app[web.1]: npm ERR! Failed at the
server#1.0.0 start script.
2021-03-21T18:33:33.290851+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:33:33.303493+00:00 app[web.1]:
2021-03-21T18:33:33.304537+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:33:33.304746+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_33_33_292Z-debug.log
2021-03-21T18:33:33.372157+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:33:33.483971+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:35:58.992675+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=af1f361c-1574-4a32-8f68-a7f0830c007a fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:36:01.295985+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=daily-mern.herokuapp.com request_id=759fada6-a151-4bdd-8689-5eab38ceaf35 fwd="177.254.11.56" dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:36:27.162149+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=a44bcfca-29b0-4264-bc39-878747caad85 fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:36:30.775177+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=daily-mern.herokuapp.com request_id=ea89bde9-0278-4ded-b9e9-95925bef286b fwd="177.254.11.56" dyno= connect= service= status=503 bytes= protocol=https
I don't understand anything, what is goin on? how can i fix that?
This is my index of my backend, i'm working with node, express and mongoDB
import express from "express";
import mongoose from "mongoose";
import cors from "cors";
import dotenv from "dotenv";
import rooms from "./routes/rooms.js";
import user from "./routes/user.js";
import tasks from "./routes/tasks.js";
dotenv.config();
const PORT = process.env.PORT || 5000;
const app = express();
app.use(express.json({ limit: "20mb", extended: true }));
app.use(express.urlencoded({ limit: "20mb", extended: true }));
app.use(cors());
app.use("/rooms", rooms);
app.use("/tasks", tasks);
app.use("/user", user);
app.get("/", (req, res) => {
res.send("");
});
mongoose.connect(process.env.MONGODB, {
useNewUrlParser: true,
useUnifiedTopology: true,
dbName: "Daily-App"
});
mongoose.set("useFindAndModify", false);
app.listen(PORT, () => {
console.log("Server Working Succesfully");
});
My procfile
web: npm run start
My package json
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"start": "nodemon index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.11.19"
}
}
If you know what's going on, i would love to read your answer, thank your for your time comunnity !
Add node version to your package.json: "engines": { "node": "v15.10.0" }
Change the "start" script from "nodemon server.js" to "node server.js". If you want to use nodemone locally, add one more script like : "dev": "nodemon server.js" and use npm run dev to start the server locally.
You must push your .env to your heroku server also.
Check if you .env file is being ignored in .gitignore.
ps: package.json: I don't see "nodemon" in your "dependencies".
did you installed it? If you installed it, it should be there like : "nodemon": "^2.0.7" or if you installed it with npm i --save-dev: "devDependencies": { "nodemon": "^2.0.7" }
Wish this help you.
I am trying to deploy a Scala HTTP4S app to Heroku.
sbt -sbt-version 1.3.12 new http4s/http4s.g8 -b 0.21
Used the above command to get the giter8 template from HTTP4S.
herokuAppName in Compile := "glacial-waters-76053"
enablePlugins(JavaAppPackaging)
Put the about lines into my build.sbt file.
addSbtPlugin("com.heroku" % "sbt-heroku" % "2.1.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.5")
Added the above to my plugins.sbt file
I then created a Procfile which has the below
web: target/universal/stage/bin/fsdeploy -Dhttp.port=${PORT}
I do NOT have anything in my application.conf file, I'm not sure how to specify a port for the above Procfile.
I have researched: https://devcenter.heroku.com/articles/deploying-scala along with a couple of Youtube videos. However all of the Youtube tutorials vary and none of which use HTTP4S.
Error I am currently getting when typing heroku logs -a glacial-waters-76053
2020-09-24T13:08:35.000000+00:00 app[api]: Build succeeded
2020-09-24T13:09:09.589928+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-09-24T13:09:09.618010+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-24T13:09:09.723909+00:00 heroku[web.1]: Process exited with status 137
2020-09-24T13:09:09.764290+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-24T13:09:09.766587+00:00 heroku[web.1]: State changed from crashed to starting
2020-09-24T13:09:13.794185+00:00 heroku[web.1]: Starting process with command `target/universal/stage/bin/fsdeploy -Dhttp.port=${8080}`
2020-09-24T13:09:16.042457+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2020-09-24T13:09:16.150395+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2020-09-24T13:09:18.212577+00:00 app[web.1]: [ioapp-compute-0] INFO o.h.b.c.n.NIO1SocketServerGroup - Service bound to address /0:0:0:0:0:0:0:0:8080
2020-09-24T13:09:18.221367+00:00 app[web.1]: [ioapp-compute-0] INFO o.h.s.b.BlazeServerBuilder -
2020-09-24T13:09:18.221370+00:00 app[web.1]: _ _ _ _ _
2020-09-24T13:09:18.221370+00:00 app[web.1]: | |_| |_| |_ _ __| | | ___
2020-09-24T13:09:18.221370+00:00 app[web.1]: | ' \ _| _| '_ \_ _(_-<
2020-09-24T13:09:18.221371+00:00 app[web.1]: |_||_\__|\__| .__/ |_|/__/
2020-09-24T13:09:18.221371+00:00 app[web.1]: |_|
2020-09-24T13:09:18.341159+00:00 app[web.1]: [ioapp-compute-0] INFO o.h.s.b.BlazeServerBuilder - http4s v0.21.5 on blaze v0.14.12 started at http://[::]:8080/
2020-09-24T13:10:14.543831+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-09-24T13:10:14.565588+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-24T13:10:14.691564+00:00 heroku[web.1]: Process exited with status 137
2020-09-24T13:10:14.729362+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-24T13:10:16.891638+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/joke" host=glacial-waters-76053.herokuapp.com request_id=1dfa6a6e-2e75-40a1-89cd-97b092a0fbe1 fwd="109.152.82.26" dyno= connect= service= status=503 bytes= protocol=https
2020-09-24T13:10:17.492951+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-waters-76053.herokuapp.com request_id=9a8f9622-e93b-4517-b5c3-fe80f426a6d7 fwd="109.152.82.26" dyno= connect= service= status=503 bytes= protocol=https
Postman is return a 503 service unavailable error.
Here is a link to the repo: https://github.com/fullStackRyan/fsdeploy
Your app will try to listen on port 8080.
You can replace the port on line 33 of your YourServerNameServer.scala from 8080 to sys.env("PORT").toInt
I try to set up Strapi + PostgresDB on Heroku.
I follow this manual step by step https://strapi.io/documentation/3.0.0-beta.x/deployment/heroku.html
When I deploy to Heroku I get: Application error
heroku logs --tail shows
npm ERR! my-host-cms#0.1.0 start: `strapi start`
2020-06-09T14:54:44.272624+00:00 app[web.1]: npm ERR! Exit status 1
2020-06-09T14:54:44.272950+00:00 app[web.1]: npm ERR!
2020-06-09T14:54:44.273144+00:00 app[web.1]: npm ERR! Failed at the my-host-cms#0.1.0 start script.
2020-06-09T14:54:44.273335+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-06-09T14:54:44.289977+00:00 app[web.1]:
2020-06-09T14:54:44.290269+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-06-09T14:54:44.290445+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-06-09T14_54_44_278Z-debug.log
2020-06-09T14:54:44.353188+00:00 heroku[web.1]: Process exited with status 1
2020-06-09T14:54:44.386798+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-09T14:54:44.388614+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-09T14:55:01.903657+00:00 heroku[web.1]: Starting process with command `npm start`
2020-06-09T14:55:05.469266+00:00 app[web.1]:
2020-06-09T14:55:05.469295+00:00 app[web.1]: > my-host-cms#0.1.0 start /app
2020-06-09T14:55:05.469296+00:00 app[web.1]: > strapi start
2020-06-09T14:55:05.469296+00:00 app[web.1]:
2020-06-09T14:55:08.015032+00:00 app[web.1]: [2020-06-09T14:55:08.013Z] error The client `sqlite3` is not installed.
2020-06-09T14:55:08.015961+00:00 app[web.1]: [2020-06-09T14:55:08.015Z] error You can install it with `$ npm install sqlite3 --save`.
and
2020-06-09T14:55:09.623864+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=my-host.herokuapp.com request_id=eea79361-593f-413e-89e2-d99d0153ddf3 fwd="37.57.145.70" dyno= connect= service= status=503 bytes= protocol=https
2020-06-09T15:01:07.901262+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=my-host.herokuapp.com request_id=ce0353b0-5e45-422d-af43-f96614c8151d fwd="37.57.145.70" dyno= connect= service= status=503 bytes= protocol=https
I see it asks about sqlite3 but I have it package.json
The project was inited with --quickstart but I have made ./config/environments/production/database.json
If you installed strapi with the --quickstart flag then by default it would provision a SQLite db for you.
since you loading a db config for postpres, make sure you installed pg.
you can npm/yarn remove sqlite3 from your package.json if you not using it locally, ie.you have postgres installed and the service is running.
delete your cache folder and then npm run build
now push to heroku and open.
fyi. it is recommended that you have database.js over database.json
eg.
module.exports = ({ env }) => ({
defaultConnection: 'default',
connections: {
default: {
connector: 'bookshelf',
settings: {
client: 'postgres',
host: env('DATABASE_HOST'),
port: env.int('DATABASE_PORT'),
database: env('DATABASE_NAME'),
username: env('DATABASE_USERNAME'),
password: env('DATABASE_PASSWORD'),
ssl: env.bool('DATABASE_SSL'),
},
options: {}
},
},
});
In Heroku make sure that the postgres addon is provisioned.
check your config vars in heroku for the app is correct.
also make sure ./config/database.js or ./config/database.json has also been corrected to use the correct database.
I developed a meanjs app on Cloud 9. I am trying to deploy my app directly on cloud 9 using heorku. Even though I followed instruction on the cloud 9 webpage, I get error:
Opening morning-tor-4953... xprop: unable to open display ''
xprop: unable to open display ''
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening 'https://morning-tor-4953.herokuapp.com/'
done
I already ran mongodb server, but I still get error saying that "Could not connect to MongoDB!"
If I hit heroku logs, get:
2015-11-19T02:38:59.583495+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=morning-tor-4953.herokuapp.com request_id=161f64ce-741e-4fdc-9ca6-9c895faa1ae5 fwd="73.162.6.191" dyno=web.1 connect=2ms service=19ms status=503 bytes=0
2015-11-19T02:38:59.574516+00:00 app[web.1]:
2015-11-19T02:38:59.579597+00:00 app[web.1]: /app/node_modules/connect-mongo/lib/connect-mongo.js:186
2015-11-19T02:38:59.579605+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
2015-11-19T02:38:59.579605+00:00 app[web.1]: at emit (events.js:106:17)
2015-11-19T02:38:59.579601+00:00 app[web.1]: throw err;
2015-11-19T02:38:59.579603+00:00 app[web.1]: Error: Error connecting to database: failed to connect to [localhost:27017]
2015-11-19T02:38:59.579606+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
2015-11-19T02:38:59.579602+00:00 app[web.1]: ^
2015-11-19T02:38:59.579607+00:00 app[web.1]: at emit (events.js:98:17)
2015-11-19T02:38:59.579608+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
2015-11-19T02:38:59.579609+00:00 app[web.1]: at Socket.emit (events.js:95:17)
2015-11-19T02:38:59.579609+00:00 app[web.1]: at net.js:441:14
2015-11-19T02:38:59.579610+00:00 app[web.1]: at process._tickCallback (node.js:448:13)
2015-11-19T02:38:59.584641+00:00 app[web.1]: error: Forever detected script exited with code: 8
2015-11-19T02:38:59.692801+00:00 app[web.1]: Application loaded using the "production" environment configuration
2015-11-19T02:38:59.587909+00:00 app[web.1]: error: Script restart attempt #1
2015-11-19T02:39:00.999132+00:00 app[web.1]: MEAN.JS application started on port 49295
2015-11-19T02:39:01.003451+00:00 app[web.1]: Could not connect to MongoDB!
2015-11-19T02:39:01.003546+00:00 app[web.1]: Error: failed to connect to [localhost:27017]
2015-11-19T02:39:03.770258+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/favicon.ico" host=morning-tor-4953.herokuapp.com request_id=a7da53eb-d4db-41ed-974d-a030a42ceb80 fwd="73.162.6.191" dyno=web.1 connect=0ms service=43ms status=503 bytes=0
2015-11-19T02:39:03.752380+00:00 app[web.1]:
2015-11-19T02:39:03.753346+00:00 app[web.1]: throw err;
2015-11-19T02:39:03.755515+00:00 app[web.1]: ^
2015-11-19T02:39:03.757380+00:00 app[web.1]: Error: Error connecting to database: failed to connect to [localhost:27017]
2015-11-19T02:39:03.757383+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
2015-11-19T02:39:03.757384+00:00 app[web.1]: at emit (events.js:106:17)
2015-11-19T02:39:03.757384+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
2015-11-19T02:39:03.757386+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
2015-11-19T02:39:03.757385+00:00 app[web.1]: at emit (events.js:98:17)
2015-11-19T02:39:03.757388+00:00 app[web.1]: at Socket.emit (events.js:95:17)
2015-11-19T02:39:03.757388+00:00 app[web.1]: at net.js:441:14
2015-11-19T02:39:03.757389+00:00 app[web.1]: at process._tickCallback (node.js:448:13)
2015-11-19T02:39:03.768047+00:00 app[web.1]: error: Forever detected script exited with code: 8
2015-11-19T02:39:03.974171+00:00 app[web.1]: Application loaded using the "production" environment configuration
2015-11-19T02:39:03.752606+00:00 app[web.1]: /app/node_modules/connect-mongo/lib/connect-mongo.js:186
2015-11-19T02:39:03.777694+00:00 app[web.1]: error: Script restart attempt #2
2015-11-19T02:39:05.613044+00:00 app[web.1]: MEAN.JS application started on port 49295
2015-11-19T02:39:05.617739+00:00 app[web.1]: Error: failed to connect to [localhost:27017]
2015-11-19T02:39:05.617448+00:00 app[web.1]: Could not connect to MongoDB!
2015-11-19T02:40:02.990789+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=morning-tor-4953.herokuapp.com request_id=2a339f1a-48d1-45b3-9f59-8615d5fcd368 fwd="73.162.6.191" dyno=web.1 connect=1ms service=42ms status=503 bytes=0
2015-11-19T02:40:02.970997+00:00 app[web.1]: throw err;
2015-11-19T02:40:02.970290+00:00 app[web.1]:
2015-11-19T02:40:02.979524+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
2015-11-19T02:40:02.979521+00:00 app[web.1]: Error: Error connecting to database: failed to connect to [localhost:27017]
2015-11-19T02:40:02.979525+00:00 app[web.1]: at emit (events.js:106:17)
2015-11-19T02:40:02.979526+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
2015-11-19T02:40:02.979527+00:00 app[web.1]: at emit (events.js:98:17)
2015-11-19T02:40:02.979528+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
2015-11-19T02:40:02.979529+00:00 app[web.1]: at Socket.emit (events.js:95:17)
2015-11-19T02:40:02.979529+00:00 app[web.1]: at net.js:441:14
2015-11-19T02:40:02.979530+00:00 app[web.1]: at process._tickCallback (node.js:448:13)
2015-11-19T02:40:02.970566+00:00 app[web.1]: /app/node_modules/connect-mongo/lib/connect-mongo.js:186
2015-11-19T02:40:02.990026+00:00 app[web.1]: error: Forever detected script exited with code: 8
2015-11-19T02:40:03.130024+00:00 app[web.1]: Application loaded using the "production" environment configuration
2015-11-19T02:40:02.976366+00:00 app[web.1]: ^
2015-11-19T02:40:02.994300+00:00 app[web.1]: error: Script restart attempt #3
2015-11-19T02:40:04.195764+00:00 app[web.1]: MEAN.JS application started on port 49295
2015-11-19T02:40:04.199716+00:00 app[web.1]: Could not connect to MongoDB!
2015-11-19T02:40:04.199776+00:00 app[web.1]: Error: failed to connect to [localhost:27017]
2015-11-19T02:40:08.179702+00:00 app[web.1]:
2015-11-19T02:40:08.179705+00:00 app[web.1]: /app/node_modules/connect-mongo/lib/connect-mongo.js:186
2015-11-19T02:40:08.179707+00:00 app[web.1]: throw err;
2015-11-19T02:40:08.179707+00:00 app[web.1]: ^
2015-11-19T02:40:08.179710+00:00 app[web.1]: at emit (events.js:106:17)
2015-11-19T02:40:08.179709+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
2015-11-19T02:40:08.179708+00:00 app[web.1]: Error: Error connecting to database: failed to connect to [localhost:27017]
2015-11-19T02:40:08.179710+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
2015-11-19T02:40:08.179711+00:00 app[web.1]: at emit (events.js:98:17)
2015-11-19T02:40:08.179712+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
2015-11-19T02:40:08.179713+00:00 app[web.1]: at net.js:441:14
2015-11-19T02:40:08.179714+00:00 app[web.1]: at process._tickCallback (node.js:448:13)
2015-11-19T02:40:08.179713+00:00 app[web.1]: at Socket.emit (events.js:95:17)
2015-11-19T02:40:08.195613+00:00 app[web.1]: error: Forever detected script exited with code: 8
2015-11-19T02:40:08.403848+00:00 app[web.1]: Application loaded using the "production" environment configuration
2015-11-19T02:40:08.198542+00:00 app[web.1]: error: Script restart attempt #4
2015-11-19T02:40:08.196245+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/favicon.ico" host=morning-tor-4953.herokuapp.com request_id=10a0b882-9c31-44d8-9e91-438506b1f0fc fwd="73.162.6.191" dyno=web.1 connect=2ms service=53ms status=503 bytes=0
2015-11-19T02:40:10.813150+00:00 app[web.1]: MEAN.JS application started on port 49295
2015-11-19T02:40:10.814675+00:00 app[web.1]: Error: failed to connect to [localhost:27017]
2015-11-19T02:40:10.814328+00:00 app[web.1]: Could not connect to MongoDB!
2015-11-19T02:50:22.474045+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=morning-tor-4953.herokuapp.com request_id=85f06246-b903-4778-9d4a-ad9f490e07e0 fwd="73.162.6.191" dyno=web.1 connect=0ms service=39ms status=503 bytes=0
2015-11-19T02:50:22.458714+00:00 app[web.1]:
2015-11-19T02:50:22.459778+00:00 app[web.1]: throw err;
2015-11-19T02:50:22.464081+00:00 app[web.1]: Error: Error connecting to database: failed to connect to [localhost:27017]
2015-11-19T02:50:22.464083+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
2015-11-19T02:50:22.464085+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
2015-11-19T02:50:22.464084+00:00 app[web.1]: at emit (events.js:106:17)
2015-11-19T02:50:22.464086+00:00 app[web.1]: at emit (events.js:98:17)
2015-11-19T02:50:22.464087+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
2015-11-19T02:50:22.464088+00:00 app[web.1]: at net.js:441:14
2015-11-19T02:50:22.464087+00:00 app[web.1]: at Socket.emit (events.js:95:17)
2015-11-19T02:50:22.472755+00:00 app[web.1]: error: Forever detected script exited with code: 8
2015-11-19T02:50:22.464089+00:00 app[web.1]: at process._tickCallback (node.js:448:13)
2015-11-19T02:50:22.459125+00:00 app[web.1]: /app/node_modules/connect-mongo/lib/connect-mongo.js:186
2015-11-19T02:50:22.462353+00:00 app[web.1]: ^
2015-11-19T02:51:05.724024+00:00 heroku[router]: at=error code=H21 desc="Backend connection refused" method=GET path="/favicon.ico" host=morning-tor-4953.herokuapp.com request_id=bf1e57b4-1812-4bcb-a960-a9b6d0e4dd50 fwd="73.162.6.191" dyno=web.1 connect=0ms service= status=503 bytes=
2015-11-19T02:53:48.794265+00:00 heroku[router]: at=error code=H21 desc="Backend connection refused" method=GET path="/" host=morning-tor-4953.herokuapp.com request_id=28f7eb8c-fbc6-423b-bde6-4295e56d07b1 fwd="73.162.6.191" dyno=web.1 connect=0ms service= status=503 bytes=
2015-11-19T02:54:19.312933+00:00 heroku[router]: at=error code=H21 desc="Backend connection refused" method=GET path="/" host=morning-tor-4953.herokuapp.com request_id=4aadb262-7f39-459f-ac5d-a95b0ce2383f fwd="73.162.6.191" dyno=web.1 connect=0ms s rvice= status=503 bytes=
2015-11-19T02:56:30.735444+00:00 heroku[web.1]: State changed from up to down
2015-11-19T02:58:47.943599+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-11-19T02:58:50.739096+00:00 heroku[web.1]: Process exited with status 143
Can you spot what cause this problem, and how to solve this issue? I downloaded whole file and tried to deploy locally, but it failed again. I think the problem is that I need some modification to Mongodb setup to deploy from my local computer because cloud 9 has different environment. Can anyone help me?
I faced the same error while developing a rails app on c9 for the first time. You simply have to click on the URL of your app (https://morning-tor-4953.herokuapp.com/) and then from them click open.
Whole day I am struggling with the deployment of my app to Heroku. Still getting there the error 500, specifically this is the output from log:
2012-03-09T16:56:25+00:00 app[web.1]: [DEPRECATION] Paperclip::Attachment.interpolations is deprecated and will be removed from future versions. Use Paperclip.interpolates instead
2012-03-09T16:56:28+00:00 app[web.1]: >> Thin web server (v1.3.1 codename Triple Espresso)
2012-03-09T16:56:28+00:00 app[web.1]: >> Maximum connections set to 1024
2012-03-09T16:56:28+00:00 app[web.1]: >> Listening on 0.0.0.0:21464, CTRL+C to stop
2012-03-09T16:56:29+00:00 heroku[web.1]: State changed from starting to up
2012-03-09T16:56:31+00:00 app[web.1]:
2012-03-09T16:56:31+00:00 app[web.1]:
2012-03-09T16:56:31+00:00 app[web.1]: Started GET "/" for _my_ip_ at 2012-03-09 16:56:31 +0000
2012-03-09T16:56:32+00:00 app[web.1]: cache: [GET /] miss
2012-03-09T16:56:32+00:00 heroku[router]: GET url_app.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=870ms status=304 bytes=0
2012-03-09T16:56:33+00:00 heroku[router]: GET url_app.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=4ms status=200 bytes=0
2012-03-09T16:56:33+00:00 app[web.1]: cache: [GET /favicon.ico] miss
What is there wrong? The log says nothing exactly, I am not sure where to search the problem... Locally works me the app well.
Could you clarify if:
What are the steps leading up to these logs: Did you try to access it in the browser or using "heroku open" from the CLI?
Was the app running successfully before and has now stopped working or is the first time you are deploying to heroku?
Is the "url_app" in your logs an edit made by you or in the logs verbatim?
Here are a couple of suggestions you could try:
If the "url_app" is verbatim from the logs, there seems to be a redirect issue with the app configuration. Try running "heroku open" from the CLI to get to the right URL
Run "heroku status" on the CLI to check if it's a heroku problem
If you could provide the above details, I'd be able to help better.