Issues deploying to fly (server + client specifically)

Hi team, just having a few issues attempting to deploy onto fly - the database has gone up totally fine, but the client and server are stuck on "pending". I've tried to redeploy by adding the db connection string to my server env file, but still getting this error Your server app does not have a DATABASE_URL secret set. Perhaps you need to create or attach your database? And both client + server are stuck on pending after several hours
6 Replies
kapa.ai
kapa.ai4mo ago
Hi @CamBlackwood. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry to hear you're having trouble deploying your Wasp app to Fly.io. Let's try to troubleshoot this issue. Firstly, the error message you're seeing suggests that the DATABASE_URL environment variable is not set. This variable is crucial for your server to connect to the database. When deploying to Fly.io, this variable should be automatically set when you create a PostgreSQL database during the Fly.io app setup process. Here are the steps you should follow when setting up a Fly.io app: 1. After building the app, navigate to the .wasp/build/ directory:
cd .wasp/build
cd .wasp/build
2. Run the launch command to set up a new app and create a fly.toml file:
flyctl launch --remote-only
flyctl launch --remote-only
3. When asked if you'd like to set up a PostgreSQL database, say yes and select Development. Fly.io will set a DATABASE_URL for you. If you've already done this and are still encountering the issue, it's possible that the DATABASE_URL was not set correctly. You can check your environment variables by running flyctl secrets list in the terminal. If DATABASE_URL is not listed, you may need to manually set it. If you're still having trouble, it might be helpful to look at the server logs on Fly.io using the flyctl logs command. This could provide more information about why the server is not connecting. For the client, ensure that you've set the WASP_WEB_CLIENT_URL environment variable to the URL where your client will be deployed. If you're not sure what this URL is yet, you can set it after you deploy your client. Lastly, remember that you can use the Wasp CLI to automate the deployment process. This includes deploying the server, client, and setting up the database. For more detailed instructions, please refer to the Wasp deployment documentation (https://wasp-lang.dev/docs/advanced/deployment/manually#flyio-server-and-database). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @CamBlackwood, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
martinsos
martinsos4mo ago
Ok that is weird! So sounds like possibly it went wrong somewhere in between deploying the db and then using that secret for the server. I would suggest you go to Fly, delete the database that was created there (and anything else), and go from scratch. You could try to fix it manually for sure, but since this is your first time deploying and there is nothing to loose, this should be the fastest. Btw I am guessing the initial issue happened due to some kind of trouble on the Fly side, that actually happens more often than one would like it seems. Also, check that you haven't reached the max number of machines on your Fly account. I believe initial limit is 15 or something like that? If that is the case, new machines will not be created
CamBlackwood
CamBlackwood4mo ago
Thanks @martinsos , just trying that now. I assume I'll need to delete the toml files that get generated?
martinsos
martinsos4mo ago
Mmm can't remember at the moment - I think you might even leave them, but would delete them just to be safe
CamBlackwood
CamBlackwood4mo ago
Thanks - I followed the steps and deleted the toml files and it all worked. Looks like it was a fly.io issue as you mentioned
martinsos
martinsos4mo ago
Perfect! Ideally our deployment script would be more resistant and also user friendly in cases like this but we didn't yet have time to improve it.
Want results from more Discord servers?
Add your server