How to use wasp deploy fly deploy command in github actions

So I've been trying to create a CI/CD pipeline for my wasp web app and I'm trying the automate the deploy process for my app with wasp deploy fly deploy in my github actions. This is what I have in my fly.yml currently:
name: Fly Deploy

on:
push:
branches:
- main # change to main if needed

jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time

steps:
- uses: actions/checkout@v4

- name: Install wasp
run: |
curl -sSL https://get.wasp-lang.dev/installer.sh | sh
echo "$HOME/.wasp/bin" >> $GITHUB_PATH

- uses: superfly/flyctl-actions/setup-flyctl@master

- name: Deploy with wasp
run: wasp deploy fly deploy
working-directory: app
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
name: Fly Deploy

on:
push:
branches:
- main # change to main if needed

jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time

steps:
- uses: actions/checkout@v4

- name: Install wasp
run: |
curl -sSL https://get.wasp-lang.dev/installer.sh | sh
echo "$HOME/.wasp/bin" >> $GITHUB_PATH

- uses: superfly/flyctl-actions/setup-flyctl@master

- name: Deploy with wasp
run: wasp deploy fly deploy
working-directory: app
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
But, I'm having issues with this command in GitHub actions that I don't have when i run it in the terminal. Like in the wasp deply fly deploy command when it gets to the flyctl secrets list -j command I get this in my github actions:
Error: Could not find App "lexal-server"
:rocket: Unable to check for DATABASE_URL secret.
Error: Could not find App "lexal-server"
:rocket: Unable to check for DATABASE_URL secret.
But in my terminal it just lists the secrets and it works perfectly. The exact same code is being pushed to my github as in my vscode and I have this gitignore:
*/.wasp/
*/.env.server
*/.env.client
*/.DS_Store
*/node_modules
*/migrations
.DS_Store
*/.wasp/
*/.env.server
*/.env.client
*/.DS_Store
*/node_modules
*/migrations
.DS_Store
I tried to remove the .wasp from gitignore to see if that was the issue and it didn't help. I have the .toml files for fly-server and fly-client already set up. Can someone help me with this?
6 Replies
MEE6
MEE6•7mo ago
Wohooo @rithvik12345678, you just became a Waspeteer level 3!
kapa.ai
kapa.ai•7mo ago
Hi @rithvik12345678. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, it seems like the issue you're facing might be related to the context in which the wasp deploy fly deploy command is being run. In your local terminal, you might have the necessary context (like the correct Fly app name) set up correctly, but this context might not be available in the GitHub Actions environment. One way to ensure that the correct context is used is to explicitly specify it when running the wasp deploy fly cmd secrets list command. You can do this by adding the --context server option to the command, like so:
wasp deploy fly cmd secrets list --context server
wasp deploy fly cmd secrets list --context server
(Source: Wasp Docs (https://wasp-lang.dev/docs/advanced/deployment/cli#cmd)) However, this might not solve the issue if the problem is that the Fly app "lexal-server" does not exist in the context of the GitHub Actions environment. In that case, you might need to ensure that the app is correctly set up on Fly.io before running the GitHub Actions workflow. If you're still facing issues, it might be helpful to look at the error messages you're getting in more detail. For example, the error message Error: Could not find App "lexal-server" suggests that the app "lexal-server" does not exist, or is not accessible, in the context of the GitHub Actions environment. You might need to ensure that the correct Fly.io API token is being used, and that the app "lexal-server" is correctly set up on Fly.io. Also, it's worth noting that the .wasp/ directory should be included in your .gitignore file, as it contains build artifacts that should not be versioned. Removing it from .gitignore is unlikely to solve the issue you're facing. (Source: Wasp Docs (https://wasp-lang.dev/docs/advanced/deployment/manually#set-up-a-flyio-app)) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @rithvik12345678, 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?
rithvik12345678
rithvik12345678•7mo ago
I found a different way to fix it
miho
miho•7mo ago
Please share if you can 🙂
rithvik12345678
rithvik12345678•7mo ago
Yeah it was just that the fly documentation said to get a personal access token using this command in the terminal
fly tokens create deploy -x 999999h
fly tokens create deploy -x 999999h
but when I initally authorized and deployed all the apps it was on a personal access token I created and these two tokens for some reason weren't directing me to the same place. So instead of the access token generated by that command, I created a new personal access token and used that for auth and it worked.
miho
miho•7mo ago
Nice, I'm glad it worked out! It can be tricky when you are setting up things for the first time, there are often unexpected behaviours like that
Want results from more Discord servers?
Add your server