`fly launch` postgres creation silent failure

Hello! Posting a potential bug report / UX issue here, as I’m not 100% sure this is clear and scoped down enough for a GitHub issue just yet.

Describe the bug
Briefly, describe what broke and provide the following details:

Running fly launch with the option to create a postgres cluster seems to have silent failure modes.

  • Operating system macOS Ventura 13.1 (22C65)
  • fly version fly v0.0.450 darwin/arm64 Commit: 51325e4a BuildDate: 2023-01-13T21:54:03Z

** Paste your fly.toml

# fly.toml file generated for full-stack-open-sql on 2023-01-14T13:10:52+02:00

app = "full-stack-open-sql"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[build]
  builder = "heroku/buildpacks:20"

[env]
  PORT = "8080"

[experimental]
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

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

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

** Command output: **

First launch

fly launch
Creating app in /Users/walther/git/full-stack-open-sql
Scanning source code
Detected a NodeJS app
Using the following build configuration:
        Builder: heroku/buildpacks:20
? Create .dockerignore from 1 .gitignore files? Yes
Created /Users/walther/git/full-stack-open-sql/.dockerignore from 1 .gitignore files.
? Choose an app name (leave blank to generate one): full-stack-open-sql
automatically selected personal organization: ***
? Choose a region for deployment: Frankfurt, Germany (fra)
Created app full-stack-open-sql in organization personal
Admin URL: https://fly.io/apps/full-stack-open-sql
Hostname: full-stack-open-sql.fly.dev
Wrote config file fly.toml
? Would you like to set up a Postgresql database now? Yes
? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
Creating postgres cluster in organization personal
Creating app...
? Would you like to set up an Upstash Redis database now? No
? Would you like to deploy now? No
Your app is ready! Deploy with `flyctl deploy`

There were no connection string or other credentials provided in the output, and fly pg connect did not work either. Next, I ran fly deploy to see if that would be needed for the database to show up. The deployment output also didn’t have any mentions of the database. I couldn’t see any database clusters either on the command line or in the web UI.

fly postgres list
No postgres clusters found

However, trying to create a database manually with fly pg create resulted in an error of not having a payment method registered, as a requirement to create more than two apps:

fly postgres create                                                                                                                                                                                                                                                                                                                                                           
? Choose an app name (leave blank to generate one): full-stack-open-sql                                                                                                                                                                                                                                                                                                                                                                   
automatically selected personal organization: ***                                                                                                                                                                                                                                                                                                                                                                           
? Select region: Frankfurt, Germany (fra)                                                                 
? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
Creating postgres cluster in organization personal                                                        
Creating app...                                                                                           
Error To create more than 2 apps please add a payment method. https://fly.io/dashboard/[redacted]/billing

At this point, I deleted the entire app in the web UI to see if recreating it would help, and this time opting for the “deploy now” option when running fly launch, but this did not prove useful.

fly launch
An existing fly.toml file was found for app full-stack-open-sql
? Would you like to copy its configuration to the new app? Yes
Creating app in /Users/walther/git/full-stack-open-sql
Scanning source code
Detected a NodeJS app
Using the following build configuration:
        Builder: heroku/buildpacks:20
? Choose an app name (leave blank to generate one): full-stack-open-sql
automatically selected personal organization: ***
? Choose a region for deployment: Frankfurt, Germany (fra)
Created app full-stack-open-sql in organization personal
Admin URL: https://fly.io/apps/full-stack-open-sql
Hostname: full-stack-open-sql.fly.dev
Wrote config file fly.toml
? Would you like to set up a Postgresql database now? Yes
? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
Creating postgres cluster in organization personal
Creating app...
? Would you like to set up an Upstash Redis database now? No
? Would you like to deploy now? Yes
==> Building image
Remote builder fly-builder-withered-glade-5224 ready
==> Building image with Buildpacks
--> docker host: 20.10.12 linux x86_64
20: Pulling from heroku/buildpacks
Digest: sha256:6401020a9dc1ce3e0993b570a3966860cd45fbbde55d242188e96fde40c821b4
Status: Image is up to date for heroku/buildpacks:20
20-cnb: Pulling from heroku/heroku
Digest: sha256:ea3e7a7b1dbb70a135dc54bf2324bf1e976d095954ebcfcf8915a82a8575127c
Status: Image is up to date for heroku/heroku:20-cnb
===> DETECTING
2 of 3 buildpacks participating
heroku/nodejs-engine 0.8.13
heroku/nodejs-npm    0.5.2
===> ANALYZING
Restoring metadata for "heroku/nodejs-engine:dist" from app image
Restoring metadata for "heroku/nodejs-engine:web_env" from app image
Restoring metadata for "heroku/nodejs-npm:node_modules" from cache
Restoring metadata for "heroku/nodejs-npm:toolbox" from cache
===> RESTORING
Restoring data for "heroku/nodejs-engine:dist" from cache
Restoring data for "heroku/nodejs-npm:node_modules" from cache
Restoring data for "heroku/nodejs-npm:toolbox" from cache
===> BUILDING
[snip]

Even after a re-launch, there were no databases to be seen:

fly pg list
No postgres clusters found

fly m list
No machines are available on this app full-stack-open-sql

Hypothesis:
I wonder if it is possible that the postgres creation fails during the fly launch but the errors are silently ignored, with no user-facing output. Perhaps the error is the same as when trying to use fly pg create manually, but ignored?

On my personal organization, I currently have one tiny existing app from before, and I’m trying out another app with a simple Node.js process and a postgres database. If I’m reading the free allowances right, this should fit within the limits:

Up to 3 shared-cpu-1x 256mb VMs
3 VM’s total between Apps and Machines

The pricing page does not seem to mention an explicit limit of 2 apps that the error message is referring to, but this could potentially be the culprit here. Maybe the 3 VMs total (between apps and machines) is intended to be shared only between two instances? Or maybe the autogenerated builder machine is counted towards these limits?

Of course any limitations you wish to have on the free tier are absolutely fair game and I’ll be happy to add a payment method to experiment more - your platform is great!

Mainly posting this issue to flag possible UX improvements - it wasn’t easy to figure out exactly what is going on here.

Thanks!

I just created an issue for this here: Postgres create silently fails when there are billing errors on fly launch · Issue #1578 · superfly/flyctl · GitHub

Organizations with no credit card are more restricted than our free tier. But fly launch should definitely show that error and halt.

1 Like