wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.73k stars 1.18k forks source link

CLI deploy fly.io unique name issue #1588

Open vincanger opened 11 months ago

vincanger commented 11 months ago

Describe the bug App name must be unique across all of fly.io or deployment with wasp deploy launch fails.

To Reproduce

Expected behavior Script should terminate and alert user to choose a new, more unique name if the created app name doesn't match the given app name

Martinsos commented 11 months ago

Quoting Vince:

noticed something weird with Fly.io deployment. It's failing to connect the DB to the Server when it autogenerates parts of the name. For example, I ran: wasp deploy fly launch open-saas and it created: open-saas-wispy-fire to be unique across all of fly.io (this is where the problem lies)

What happens is that on the fly.io dashboard it created: open-saas-server-wispy-fire-4715 But the command getting run in our script is: $ flyctl postgres attach open-saas-wispy-fire-4715-db -a open-saas-wispy-fire-4715-server So we get: Error: failed retrieving app open-saas-wispy-fire-4715-server

The issue being that server is in the middle of the name, not the end (edited)

Why this is not great:

  1. if we use a name that someone else used, deployment fails
  2. if we deploy and it fails, we can't use the same command again. Why not? we've got .toml files, can't we recognize taht and skip steps?
Martinsos commented 11 months ago

This happened because open-saas name was already taken on fly it seems.

infomiho commented 2 months ago

We should check if the app names are taken on Fly before using them. It's not really possible to check with the Fly CLI directly if an app name is taken. It is however possible to:

Checking the output

If we did something for an app called potatoes-server we expect to see potatoes-server.fly.dev in the output. If we don't see it, we know something went wrong and we can abort.

Using the GraphQL API

We can send a request to https://api.fly.io/graphql (details on using it https://til.simonwillison.net/fly/undocumented-graphql-api) with the query:

{
  appNameAvailable(name: "wasp-ai-server")
}