Issue with Environment Variables after Binding Custom Domain on Fly.io
I deployed my client application using the environment variable REACT_APP_STRIPE_CUSTOMER_PORTAL=https://billing.stripe.com/p/login/test_14k9Cw2nYgbz25i7ss wasp deploy fly deploy. Everything worked fine until I bound my own domain. After binding the domain, all the environment variables stopped working and I haven't been able to rebind them. How can I resolve this issue?
5 Replies
Hi @Jeremy_Xie. 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 knowledge sources provided, it seems like you might need to set your environment variables again after binding your custom domain. Here's how you can do it:
1. Set your domain as the
WASP_WEB_CLIENT_URL
environment variable for your server app:
Replace <https://mycoolapp.com
> with your domain.
2. Set your other environment variables in a similar way. For example, for the REACT_APP_STRIPE_CUSTOMER_PORTAL
variable, you would do:
Remember to replace the URL with your actual Stripe customer portal URL.
This should update your environment variables and make them available to your application again.
If you're still having issues, it might be worth checking if there are any known issues or solutions in the Wasp Github Issues (https://github.com/wasp-lang/wasp/issues) or asking for help in the Wasp Discord community (https://discord.com/channels/686873244791210014/).
Sources:
- Using a Custom Domain For Your App (https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app)
- Github Issue: Client side env vars are getting loaded from .env.server? (https://github.com/wasp-lang/wasp/issues/1354)
- Discord support thread: How to I set/import REACT_APP_SOME_VARIABLE_NAME for client side when in production on fly.io? (https://discord.com/channels/686873244791210014/1220070515276775516)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Jeremy_Xie, 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?REACT_APP_SOME_VAR_NAME=somevalue wasp deploy fly deploy not work for me now
I am using flyctl secrets set and worked
Can you share the full command you used?
So, if I understand correctly, you got it working now?
I don't think it's an issue with Wasp. Fly.io has been acting strange lately. According to the documentation, I frequently encounter problems, such as failing to bind the domain name, although everything worked fine a few weeks ago. I'm planning to switch to AWS.
Thank you for taking the time to respond. Wasp is really great!
Got it @Jeremy_Xie , and thanks! If you will be switching to AWS, we would appreciate any feedback on how it went -> it would be ideal if you cold open a GH issue on wasp-lang/wasp repo and describe shortly how you deployed to AWS, then we can use that to write docs from it.