Unable to connect to deployed fly io node express app

Howdy, beginner here. Thanks in advance, haven’t deployed an app before so bear with me please :sweat_smile:

I have an express nodejs app I’m able to deploy, but when accessing the url I get a connection reset error.

The app works locally on localhost:8080, both when I simply execute npm start and when I locally build and run a docker container for my app (though I do need the option -p 8080:8080 when I run it as a docker container.)

The app is displayed as deployed in the fly overview. The monitoring doesn’t show anything off in the logs, aside from a punycode deprecation module warning:

2024-01-15T04:48:08.618 app[178113d9ce3168] mia [info] > node ./dist/www.js

2024-01-15T04:48:09.115 app[178113d9ce3168] mia [info] Available at http://localhost:8080

2024-01-15T04:48:09.115 app[178113d9ce3168] mia [info] (node:395) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.

2024-01-15T04:48:09.116 app[178113d9ce3168] mia [info] (Use `node --trace-deprecation ...` to show where the warning was created)

The Dockerfile, and fly.toml is left as when it was initially generated by flyctl

Here’s the initial file run by npm start:

I have no idea what to try to fix it. Here’s the link to the entire project:
GitHub - Joel-Singh/Florally-Great: Florally-Great, its just a simple app with CRUD operations using mongoose.

I’ve looked at this post describing .dockerIgnore being an issue:

I tried removing fly.toml and Dockerfile from my dockerignore

I’ve gone through this article:

fly doctor didn’t output any errors

I don’t know what else to try

And thank you once again for any help :grin:

Hey!

Looking at your fly.toml, it seems like you are missing configuration for the fly proxy. You can add a http_service section in your fly.toml. An example block for your app would be:

[http_service]
  internal_port = 8080
  force_https = true

Also, make sure you bind to 0.0.0.0.

1 Like

HEY IT WORKED! Thank you soooo much. I’ve been at this for a while trying to get it to work :laughing:

1 Like

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