Cannot Deploy NodeJS App

flyctl deploy          
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-long-tree-1131 ready
==> Building image with Buildpacks
--> docker host: 20.10.12 linux x86_64
20: Pulling from heroku/buildpacks
Digest: sha256:191b4d9fdb962a60000045837b992c8b70dda02b7cd246623dc12410e36ede72
Status: Image is up to date for heroku/buildpacks:20
20-cnb: Pulling from heroku/heroku
Digest: sha256:26ec15fdf56a83cf90ecbf0efdb0bd41a446b5051d2d65163b1a22d5554f7299
Status: Image is up to date for heroku/heroku:20-cnb
===> DETECTING
2 of 3 buildpacks participating
heroku/nodejs-engine 0.8.9
heroku/nodejs-npm    0.5.2
===> ANALYZING
Restoring metadata for "heroku/nodejs-engine:web_env" from app image
===> RESTORING
===> BUILDING

[Heroku Node.js Engine Buildpack]

[Checking Node.js version]
Detected Node.js version range: 16.6.0
Resolved Node.js version: 16.6.0

[Installing Node.js distribution]
Downloading Node.js 16.6.0

[Error: Node.js engine distribution error]
Couldn't download Node.js distribution: HTTP error while downloading file: https://heroku-nodebin.s3.us-east-1.amazonaws.com/node/release/linux-x64/node-v16.6.0-linux-x64.tar.gz: Connection Failed: Connect error: connection timed out
ERROR: failed to build: exit status 1
Error failed to fetch an image or build from source: executing lifecycle: failed with status code: 51

Hi, I cannot deploy a NodeJS app, I get this error while it downloads a Node version, I tried restarting the agent, the tokens, restarted cmd and deleted the app. But I get the same error. What could be the issue with my repo?

Hi, Which region or regions are you currently trying to deploy too?

It is likely a temporary fault with downloading that particular file, as it says connection failed. Perhaps, as @Christian_B suggests, that’s down to the region. Since I just tried downloading it, out of interest, and the download started.

You could wait, try again, and it may resolve itself.

However if not, your other option would be to use a Dockerfile. Since Fly has two main ways to deploy an app. The default is the one you have found, the builder. Fly will try to work out what kind of app you have and use an appropriate builder. Hence you getting the nodejs one. And that should work (but isn’t, as of now).

That leaves the other approach of using a Dockerfile. Basically that file tells Fly how to build an image that includes your app. And it’s combined with a .dockerignore which does at its name suggests and says what files not to include (.env etc). If you wanted to try out that approach instead, take a look at this hello world nodejs app. You basically just need a Dockerfile and .dockerignore in the root folder, something along these lines:

2 Likes