Trouble deploying uvicorn backend for NextJS app

Hey everyone!

I’m pretty new to web dev, so this could be an incredibly stupid problem.

I’m having some issues deploying a Dockerfile app. My NextJS frontend loads just fine on https://chat-twitter.fly.dev, but the requests to my uvicorn backend aren’t going through (my web console is showing net::ERR_CONNECTION_RESET). My fly.toml is as follows:

# fly.toml file generated for chat-twitter on 2023-04-13T10:44:35-05:00

app = "chat-twitter"
kill_signal = "SIGINT"
kill_timeout = 5
primary_region = "dfw"

[processes]
  web = "npm run start"
  backend = "uvicorn backend.main:app --host 0.0.0.0 --port 8000"

[[services]]
  protocol = "tcp"
  internal_port = 8080
  processes = ["web"]

  [[services.ports]]
    port = 80
    handlers = ["http"]
    force_https = true

  [[services.ports]]
    port = 443
    handlers = ["tls", "http"]
  [services.concurrency]
    type = "connections"
    hard_limit = 25
    soft_limit = 20

Is this some sort of issue with SSL/TLS? I’m at a loss.

I’m not sure why you’re getting connection reset, but it’s not possible to route HTTP requests like this to two process groups in an app. The easiest thing to do here would be to create two apps, one for your frontend and one for your backend.

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