Deno chatbot app will not deploy

Howdy flycatchers!

I’m trying to deploy a deno app using the grammy library; it’s a chatbot library that talks to Telegram. Telegram can communicate back to your bot using HTTPS webhooks so I thought might be a perfect deployment platform.

I have had zero luck deploying my deno app, however. flyctl was unable to detect my deno app (is it because the code was in the src/ directory instead of at the root of the repo?). flyctl launch ended up making me a slightly generic fly.toml, which I thought would work:

# fly.toml file generated for yorick on 2022-05-16T10:09:00-05:00

app = "yorick"

kill_signal = "SIGINT"
kill_timeout = 5

  YORICK_PROD = "true"

  allowed_public_ports = []
  auto_rollback = true

  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

    hard_limit = 25
    soft_limit = 20
    type = "connections"

    handlers = ["tls", "http"]
    port = 443

    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

My Dockerfile is below:

FROM denoland/deno:1.21.3



USER deno

COPY ./src .
RUN deno cache server.ts

CMD ["run","--allow-net", "--allow-env", "server.ts"]

That server is listening on port 8080 and on the hostname “”.

What I see in the console is this:

==> Monitoring deployment

 1 desired, 1 placed, 0 healthy, 1 unhealthy
--> v6 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v7

It’s never deployed successfully, so there’s nothing to roll back to. There’s nothing in the logs. The Monitoring tab in the dashboard shows 1 desired, 1 placed, 0 healthy, 1 unhealthy and a big section that says “Waiting for logs…” with nothing after it.

When I build and run that Docker image locally, the container starts successfully and takes requests. I’m kind of at a loss here. Any debugging tips?

I know JavaScript pretty well but I’m a deno newbie; would removing deno from the mix make things simpler?

It appears the app is running now. Did you have to change something?

1 Like

Yup! But I committed the cardinal sin of changing three things at once – now I’m not sure which one fixed it.

I spent a bit of time reading LOG_LEVEL="DEBUG" flyctl deploy to see if anything popped out. Nothing did. Still got an error.

I switched the port from 8000 to 8080 because I was cargo culting the community; I saw some people suggesting that the port should really be set to the default.

I realized that I hadn’t set a secret, without which my app wouldn’t start. Normally, without that environment variable/secret it logs an error, but who knows. I tried to set the secret with flyctrl secrets set YORICK_BOT_TOKEN=xxxx and got this weird error, something like:

Error Could not resolve VaultSecret

I thought, “Well, that’s not right.” I’d seen some strange “can’t mount” errors during deploy, or something like that?

So I deleted the app entirely from the dashboard. I re-ran flyctrl launch to re-generate fly.toml. It detected the Dockerfile and added some lines I didn’t have before:

    force_https = true
    handlers = ["http"]
    port = 80

I made sure to set my secret. My Dockerfile was still generating a container that started locally.

I ran flyctl deploy and it was smooth sailing this time. I could see logs way sooner than I’d seen before. And now my app is running!

I even made a tiny change and re-deployed successfully. About to hook up a GitHub action, so I think I’m good. But I wish I knew what changed or if I fixed it.