Constant node.js deploy failures

I’m trying to deploy my prototype. In the few days I’ve been using Render it’s only successfully deployed once. Can I get some help getting this resolved please?

Hey @uxjay505

There could be a number of reasons, and its hard to find out whats wrong without more information.

Do you have the logs for your failed deployments?
Could you share the setup for the service e.g. build and start commands, etc?

Best regards
Bergur

This is the log of the last failed deployment a few minutes ago:

Dec 15 11:00:52 AM ==> Cloning from GitHub - jmoseley505/uam
Dec 15 11:00:53 AM ==> Checking out commit fec11c6318133890f34c3cb263c378be0d7d9518 in branch main
Dec 15 11:00:52 AM ==> Cloning from GitHub - jmoseley505/uam
Dec 15 11:00:53 AM ==> Checking out commit fec11c6318133890f34c3cb263c378be0d7d9518 in branch main
Dec 15 11:00:55 AM ==> Downloading cache…
Dec 15 11:01:07 AM ==> Detected Node version 16.15.0
Dec 15 11:01:07 AM ==> Running build command ‘npm install; npm run-script build’…
Dec 15 11:01:07 AM
Dec 15 11:01:07 AM up to date in 615ms
Dec 15 11:01:07 AM
Dec 15 11:01:07 AM 37 packages are looking for funding
Dec 15 11:01:07 AM run npm fund for details
Dec 15 11:01:08 AM
Dec 15 11:01:08 AM > govuk-prototype-kit@12.2.0 build
Dec 15 11:01:08 AM > node lib/build/generate-assets
Dec 15 11:01:08 AM
Dec 15 11:01:08 AM compiling CSS…
Dec 15 11:01:11 AM compiling CSS…
Dec 15 11:01:12 AM copying assets…
Dec 15 11:01:12 AM copying assets…
Dec 15 11:01:12 AM ==> Generating container image from build. This may take a few minutes…
Dec 15 11:01:06 AM ==> Transferred 80MB in 7s. Extraction took 2s.
Dec 15 11:02:33 AM ==> Uploading build…
Dec 15 11:02:59 AM ==> Build uploaded in 18s
Dec 15 11:03:00 AM ==> Build successful :tada:
Dec 15 11:03:00 AM ==> Deploying…
Dec 15 11:02:59 AM ==> Build uploaded in 18s
Dec 15 11:03:00 AM ==> Build successful :tada:
Dec 15 11:03:00 AM ==> Deploying…

Build command: $npm install; npm run-script build

Start command: $npm run-script serve

Region: Frankfurt

I am not sure that I follow your code.

the serve script calls listen-on-port.js which in turns requires the server and invokes utils.findAvailablePort that reads some port.tmp file and then tries to find a port not in use.

I am not exactly sure why all this is necessary? Maybe I am missing something.

All you need to to do start your service is server.listen(process.env.PORT) -
since render will assign you you a port.

To be honest with you, I don’t completely follow the code either as I’m not a developer. I set this up with the help of my team’s devs. What would you suggest that I do. Go back to them? Is there a better way that we can communicate i.e. over a video call?

Hi there,

As Bergur suggested, the code seems to be doing all sorts of odd lookups and port calculations.

Essentially, you’re using Express, so you just need to either use our default port - 10000 - available in the PORT env var.

Or, use your own port by overriding PORT in the “Environment” tab of the service (3000 seems set your repo, app/config.js)

Our “Hello World” Express repo also shows an example of this: https://github.com/render-examples/express-hello-world/blob/master/app.js#L7

Hope that helps

Alan

Hi,

I’m still having problems with my deployments. The thing is that as mentioned before, I’ve only had 2 successful deployments out of near 50. But the settings didn’t change between the successful and failed deployments, so I don’t know how this could have happened. I’m quite disappointed with it all to be fair.

If 2 were successful, what did you change to make them fail again?

If you could you share some specific details of the issue you are experiencing that may help us troubleshoot it with you, e.g. any logs/errors/output, specific URLs, service name/ID, reproduction steps, etc. If you don’t want to share these details on the community forum, please feel free to raise a ticket from the “Contact Support” link at the bottom of the Dashboard.

Alan

Hi

Thank you for your prompt reply. I hadn’t changed anything as I had help from my dev team to set this up.

Based on your reply I will contact support as you have suggested, I need someone to walk through my issues step by step.

Thank you.

If you hadn’t changed anything, how would you expect the result to be different?

As your repo was linked above and public, I forked it and deployed it to my own account:

Build Command: npm install && npm run build

Start Command: node listen-on-port

And it serves content: https://uam-demo.onrender.com/

It’s tough to troubleshoot when we don’t have visibility on what you see, again, please feel free to raise a ticket from the “Contact Support” link at the bottom of the Dashboard if you want us to take a look at your specific service. However, with the service I just spun up, I’m not seeing any issues on the Render side.

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.