Unable to deploy flask application

I am not able to deploy my flask app at https://replit.com/@thercyl/ProductLaunches-v3. The error is: error: The deployment failed to initialize due to a configuration or code error. Check the logs tab for more information. For additional support, contact us at support@replit.com.

The ports configured in .replit are:

[[ports]]
localPort = 80
externalPort = 3000

Below is what’s in the logs. What am i doing wrong?

2024-07-07 14:05:07.86

55772e05

System

starting up user application

2024-07-07 14:05:08.14

55772e05

System

forwarding local port 80 to external port 80

2024-07-07 14:05:11.33

55772e05

User

* Serving Flask app 'main'

2024-07-07 14:05:11.33

55772e05

User

* Debug mode: off

2024-07-07 14:05:11.34

55772e05

User

WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.

2024-07-07 14:05:11.34

55772e05

User

* Running on all addresses (0.0.0.0)

2024-07-07 14:05:11.34

55772e05

User

* Running on http://127.0.0.1:80

2024-07-07 14:05:11.34

55772e05

User

* Running on http://169.254.8.1:80

2024-07-07 14:05:11.34

55772e05

User

Press CTRL+C to quit

2024-07-07 14:05:16.68

55772e05

User

127.0.0.1 - - [07/Jul/2024 21:05:16] "GET / HTTP/1.1" 200 -

2024-07-07 14:05:27.04

55772e05

User

127.0.0.1 - - [07/Jul/2024 21:05:27] "GET / HTTP/1.1" 200 -

2024-07-07 14:05:37.41

55772e05

User

127.0.0.1 - - [07/Jul/2024 21:05:37] "GET / HTTP/1.1" 200 -

2024-07-07 14:05:47.77

55772e05

User

127.0.0.1 - - [07/Jul/2024 21:05:47] "GET / HTTP/1.1" 200 -

2024-07-07 14:05:58.13

55772e05

User

127.0.0.1 - - [07/Jul/2024 21:05:58] "GET / HTTP/1.1" 200 -

Hi @thercyl !
Are you using Autoscale deployments to deploy your bot?

yes. im using autoscale.

Hmm. And the apps works in development?

yes. the app works in development.

also, fwiw, an older deployment from 2 days ago still runs but i can’t redeploy a new version. the only thing i changed in between is the html code.

1 Like

Very odd. And the Logs tab provides no info?
Let me ask a staff member to respond here.

@thercyl Hi there.
It vaguely strikes me as some kind of port issue. Can you delete your entire [[ports]] section in the .replit and try re-deploying? Give it a minute after you delete it to make sure the changes save/sync. We’ll let the port auto-detection do its magic then.

If the issue persists, would you mind inviting me to your Repl? I do see the public link to your Repl but the invite will give me better visibility. My username is:
SuzyAtReplit

2 Likes

hey suzy, i tried your recommendation and am still not able to deploy. i have added you as an editor to my repl. pls take a look and thanks for your help.

hi @SuzyAtReplit any thoughts on how to resolve my issue?

@thercyl I’m going to sync up with the team on this one. I did try a few things with a forked version, such as using gunicorn and different port configurations, but I ran into other issues so I wanted a second opinion from the team.

I will say that deploying via Reserved VM was successful. So if you’re in urgent need of deploying, you can always use that for now.

Let me know if you end up testing anything else.

1 Like

@thercyl Okay, so I have some answers for you. We are not sure why the Autoscale was deploying successfully before (and maybe it shouldn’t have), but we don’t recommend Autoscale here.

In short, the way your application is structured doesn’t work well for Autoscale. If we’re understanding correctly, there’s an HTTP server and a background thread that runs once a day. Autoscale is best for apps that just serve requests, with no guarantees as to how long an instance might run continuously.

We would recommend either a Reserved VM or breaking apart the scheduled functionality into separate Scheduled Deployments. That would be best and as I tested with Reserved VM already, we know it would deploy successfully as well.

Hope it helps!

3 Likes