Setting server secret env values and Stripe Webhook upon Fly.io deployment?
Hi, I'm working on launching my Wasp project! While I'm very excited, I'm also very confused. I'm using the 'wasp deploy fly' command with fly.io.
The docs only very briefly mention the server secrets. It looks like I have to manually set each and every one? That's a bit troublesome as I'm using like 10 different values. Is this correct? You just have to manually set all those via commands?
But more importantly, how does the Stripe Webhook get set? Don't we have to run that webhook via a terminal somewhere, get the generated value, then set it? How does this work with fly.io? Any guidance would be more than greatly appreciated!
3 Replies
Hi @jason. 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, I can answer your questions about setting server secret env values and Stripe Webhook for Fly.io deployment with Wasp. Let's address your concerns one by one:
1. Setting server secret env values:
Yes, you are correct that you need to set each server secret manually. The Wasp CLI provides a way to set these secrets during deployment. You can use the
--server-secret
option with the wasp deploy fly launch
command to set multiple secrets at once. Here's an example from the Wasp CLI documentation:
You can add multiple --server-secret
options for each secret you need to set. While it might be a bit cumbersome for 10 different values, this is the current method provided by Wasp for setting server secrets during deployment.
Alternatively, if you've already deployed your app, you can use the secrets set
command to add or update secrets:
This command allows you to set multiple secrets at once, which might be more convenient for your case with multiple values.
2. Setting up Stripe Webhook:
For the Stripe Webhook, you don't actually need to run it via a terminal when deploying to Fly.io. Instead, you need to set up the webhook in your Stripe Dashboard to point to your deployed server. Here's how you can do it, based on the information from the Discord support thread:
1. In your Stripe Dashboard, go to the Developers > Webhooks section.
2. Create a new webhook by URL, pointing to your server URL + "/stripe-webhook" endpoint (e.g., <https://your-fly-server-domain.fly.dev/stripe-webhook
>).
3. After creating the webhook, Stripe will provide you with a Webhook Secret.
4. Add this Webhook Secret to your Fly.io app's environment variables using the command:
5. Make sure your server code is set up to handle the webhook at the "/stripe-webhook" endpoint.
By following these steps, your Fly.io deployed server will be able to receive and process Stripe webhooks without needing to run a separate webhook process.
Remember to update your Wasp project's configuration and server code to properly handle the Stripe webhook and use the STRIPE_WEBHOOK_SECRET
environment variable.
I hope this information helps clarify the process for setting server secrets and configuring the Stripe Webhook for your Wasp project on Fly.io!
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @jason, 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?Look at my recent post and you'll find a good doc about the stripe docs with wasp
Just deploy the secrets like secret=xxx \
secret2=yyy \
secret3=zzz
Open Saas is based on Wasp and I'd recommend checking out the docs on env variables: https://wasp-lang.dev/docs/project/env-vars
We talk about the env variables in the context of Fly deployment here: https://wasp-lang.dev/docs/advanced/deployment/cli
Env Variables | Wasp
Environment variables are used to configure projects based on the context in which they run. This allows them to exhibit different behaviors in different environments, such as development, staging, or production.
Deploying with the Wasp CLI | Wasp
Wasp CLI can deploy your full-stack application with only a single command.