Reputation: 21
I'm trying to deploy a simple nodejs app served in express and Pm2, via a Docker container on Heroku.
Following the steps defined by heroku, the container is sucessfully pushed to heroku:
Here is the log of heroku showing the success on running the image and assigning a dyno to the process Container Deployment Log
Here is when the problem comes: while accessing to the apps routes the Heroku H14 Error is throw, which happens when a proccess doesn't have Dynos, which in my case it have. Error H14 Log
I'm out of ideas as the reason this error is raising. I know it might be a silly mistake thought XD!!
Here you got the code for my app:
const express = require('express')
const app = express()
//require('./database')
app.use(express.json())
app.use(express.urlencoded({ extended: false }))
console.log('App is Running, yaaaay')
app.get("/", (req,res) => {
res.send("OK")
})
app.listen(3000)
and its run with Pm2:
"scripts": {
"dev": "nodemon ./src/app",
"start": "pm2-runtime ./src/app.js --watch --name WD-Bot"
},
Also, here you got my DockerFile. I'm pretty newbie on Docker, so i probably messed up on here T-T?
FROM node:12.18-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
Upvotes: 2
Views: 1303
Reputation: 5330
You did:
heroku container:push name-of-container -a name-of-herokuApp
You assume that's the name of the container. That's wrong. As per https://devcenter.heroku.com/articles/container-registry-and-runtime#build-an-image-and-push that's the process type:
heroku container:push <process-type>
The error message you are receiving is:
ERROR H14:No web processes running
You named your process wd-bot
and not web
.
After changing your process type to web
you'll have to properly bind the $PORT
as well. See: https://help.heroku.com/P1AVPANS/why-is-my-node-js-app-crashing-with-an-r10-error
But that's a different topic and is a new question.
Upvotes: 6