W
Waspβ€’5mo ago
KC

A possible bug: wasp deploy fly deploy resets the server URL

Hello Waspeteers! πŸ‘‹ When we use the wasp deploy fly deploy command, it looks like the server URL (env variable when building the client here: https://github.com/wasp-lang/wasp/blob/8d5530519bb5e99ec7d87caf3c807785f19954dc/waspc/packages/deploy/src/providers/fly/deploy/deploy.ts#L107) is being derived from the base name (https://github.com/wasp-lang/wasp/blob/8d5530519bb5e99ec7d87caf3c807785f19954dc/waspc/packages/deploy/src/providers/fly/DeploymentInfo.ts#L30). Can we override this somehow? We are using the deploy-action (https://github.com/wasp-lang/deploy-action) in our CI and our server URL is api.schooltendance.com. This gets reset to the fly.dev URL every time we 🚒.
GitHub
GitHub - wasp-lang/deploy-action: Github Action to deploy with Wasp...
Github Action to deploy with Wasp to Fly.io. Contribute to wasp-lang/deploy-action development by creating an account on GitHub.
GitHub
wasp/waspc/packages/deploy/src/providers/fly/deploy/deploy.ts at 8d...
The fastest way to develop full-stack web apps with React & Node.js. - wasp-lang/wasp
GitHub
wasp/waspc/packages/deploy/src/providers/fly/DeploymentInfo.ts at 8...
The fastest way to develop full-stack web apps with React & Node.js. - wasp-lang/wasp
7 Replies
kapa.ai
kapa.aiβ€’5mo ago
Hi @KC (GitHub @Case-E). 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 provided knowledge sources, it seems that the server URL is indeed derived from the base name during the deployment process. However, there isn't any explicit information available on how to override this behavior. One possible workaround could be to manually set the WASP_WEB_CLIENT_URL environment variable after the deployment. This can be done using the flyctl secrets set command as mentioned in the Wasp documentation (https://wasp-lang.dev/docs/advanced/deployment/manually#deploy-to-a-flyio-app). Here is the command:
flyctl secrets set WASP_WEB_CLIENT_URL=<url_of_deployed_client>
flyctl secrets set WASP_WEB_CLIENT_URL=<url_of_deployed_client>
Replace <url_of_deployed_client> with your desired server URL (api.schooltendance.com). However, please note that this is a workaround and might not be the best solution for your use case, especially if you are using CI/CD pipelines for deployments. It would be best to raise this issue directly with the Wasp team for a more robust solution. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @KC (GitHub @Case-E), 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?
KC
KCOPβ€’5mo ago
As a workaround, I am building the client from .wasp/build/web-app and then deploying with the correct value for the REACT_APP_API_URL variable. The env variable WASP_SERVER_URL is set to the correct URL but still doesn't work. I am guessing this could be a simple fix with something like: const serverUrl = process.env.SERVER_URL || deploymentInfo.serverUrl; If there isn't any other way, I am happy to fix this in a PR. I was exploring the codebase and I am also seeing other places that are referring to the WASP_SERVER_URL, we could possibly use that for consistency?
KC
KCOPβ€’5mo ago
GitHub
Override serverUrl in wasp deploy fly deploy command by Case-E Β· Pu...
Description Fixes #2233 Select what type of change this PR introduces: Just code/docs improvement (no functional change). Bug fix (non-breaking change which fixes an issue). New feature (non-br...
miho
mihoβ€’5mo ago
I guess the fix lies in this message If you configured a custom domain for the server, please run the command with an env variable: REACT_APP_API_URL=https://serverUrl.com wasp deploy fly deploy Which means that if the deployment action sets the REACT_APP_API_URL to a certain value, it should be all good?
miho
mihoβ€’5mo ago
GitHub
deploy-action/action.yml at main Β· wasp-lang/deploy-action
Github Action to deploy with Wasp to Fly.io. Contribute to wasp-lang/deploy-action development by creating an account on GitHub.
KC
KCOPβ€’5mo ago
@miho I think the deploy action should also allow you to set a variable and the :wasplang: CLI should also use that when generating the client like I've pushed here: https://github.com/wasp-lang/wasp/pull/2234/files#diff-bff2e4075ad24d9e91eb8d133842dea04ea1bd24d9f2318186ab80cf96348d0eR111 I am going to test this out today and see if it works as expected.
GitHub
Override serverUrl in wasp deploy fly deploy command by Case-E Β· Pu...
Description Fixes #2233 Select what type of change this PR introduces: Just code/docs improvement (no functional change). Bug fix (non-breaking change which fixes an issue). New feature (non-br...
KC
KCOPβ€’5mo ago
The deploy action should only set it if the variable is set by the user in GitHub.
Want results from more Discord servers?
Add your server