Deploying ExpressJs app with buildpack

  • databases: MongoDB

  • Programming language and version: NodeJs

  • OS: Windows 10

  • Url to environment: here

  • Can’t provide github repository due to some reasons. But if required I will be sharing snippets around the thread.

Getting deployment error in my nodejs server application

I have choosen buildpack option instead of docker file option. Now I am getting errors, please tell me is there anny exceptions to add in code base like configuring run and build commands in package.json or something like that.

Hello,
could you please respect this few rules Rules for the Questions and Answers section ? It would help me to help you.

Yeah, I have written post accordingly, if still any issue, let me know.

  • The URL of your environment (starting with console.qovery.com/platform … )
  • If possible provide a link to your project on Github, Gitlab, Bitbucket, etc…

are missing.

Please acknowledge according to modification I made right now.

Just checked, your app failed to start that’s why you have a deployment error.

Yes, it is failing to start, please give me some tip what to should I do to make it run.

It’s code stuff, I can’t help much…

Does it run locally ?

Yes, it is running perfect on local development server and I have hosted it using another platform also, it working fine there. I think I am missing to make some important configuration in my code or Qovery console setting.

I think the error is due to builpacks then. Did you try with a dockerfile ?

No, I didn’t try working with a dockerfile. I want to use buildpack only. However if things don’t go right with buildpack, I will go for dockerfile option.

Try removing package-lock.json from your repo and create a new app. Worked for me.

I tried without package-lock.json right now, still it is giving following errors:

07 Aug, 07:51:51.494
npm ERR! /app/.npm/_logs/2021-08-07T02_21_51_484Z-debug.log

07 Aug, 07:51:51.494
npm ERR! A complete log of this run can be found in:
07 Aug, 07:51:51.493
07 Aug, 07:51:51.484
npm ERR! command sh -c node index.js
07 Aug, 07:51:51.483
npm ERR! signal SIGTERM
07 Aug, 07:51:51.483
npm ERR! command failed
07 Aug, 07:51:51.481
npm ERR! path /workspace
07 Aug, 07:51:51.478
npm notice
07 Aug, 07:51:51.477
npm notice Run `npm install -g npm@7.20.5` to update!
07 Aug, 07:51:51.477
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.20.5>
07 Aug, 07:51:51.477
npm notice New patch version of npm available! 7.20.3 -> 7.20.5
07 Aug, 07:51:51.476
npm notice

Did you create a new application after deleting package-lock.json? Would you mind me taking a look at your package.json?

Yeah, I tried many things, I think I am missing some files that are required by qovery buildpack to deploy my application, for eg. in docker option you need a docker file.
However here’s my package.json:

{
  "name": "Server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "start": "node index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.19.0",
    "cors": "^2.8.5",
    "dotenv": "^10.0.0",
    "express": "^4.17.1",
    "googleapis": "^82.0.0",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.12.14",
    "nodemailer": "^6.6.2",
    "nodemon": "^2.0.7",
    "web-push": "^3.4.5"
  }
}

I ran a test project with your package.json and it works just fine. I guess there’s something wrong with your code. Make sure your Express App listens on port 3000. And if your app uses environment variables, set them in Qovery console.

One thing you might try adding in package.json is the “engines” property where you can specify the version of node and npm.

"engines": {
        "node": "14.x",
        "npm": "7.x"
}

Thank you so much Deutsch. I was using diffrent ports in qovery console and my code, that was the only issue. We should use same ports, got it. Thank you :slight_smile:

1 Like