Railway deployment faild
- SENDGRID_API_KEY is required when using SendGrid email sender
I added in variables, I don't know where I need to add more
4 Replies
Hi @Aleksandar Okiljevic. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It sounds like your app is configured to use the SendGrid provider, but Railway doesn’t see the SENDGRID_API_KEY in the server service’s environment.
Do this on Railway (server service):
1) Verify you’re actually using SendGrid
- In main.wasp, provider should be SendGrid. [Sending Emails]
- If you’re using SendGrid, you must provide SENDGRID_API_KEY. [SendGrid provider] 2) Set the env var on Railway (server)
- Go to your Railway project → select the server service → Settings → Variables.
- Add SENDGRID_API_KEY with your actual SendGrid API key. [SendGrid provider]
- While you’re there, also ensure the other required server vars are set (DATABASE_URL via Variable Reference, WASP_WEB_CLIENT_URL, WASP_SERVER_URL, JWT_SECRET). [Deploying the Server] 3) Redeploy the server
- After adding the variable(s), trigger a new deploy (e.g., railway up for the server). [Deploying the Server] Notes: - SENDGRID_API_KEY should be on the server only (equivalent of .env.server locally), not on the client. [Providers; SendGrid provider] - If you’re not ready to configure SendGrid yet, switch the provider to Dummy during development (builds to production will fail with Dummy). [Providers] If you’ve already set SENDGRID_API_KEY, double-check it’s on the correct Railway service (server), spelled exactly as SENDGRID_API_KEY, and that the new deployment picked it up. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Aleksandar Okiljevic, 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?
- In main.wasp, provider should be SendGrid. [Sending Emails]
- If you’re using SendGrid, you must provide SENDGRID_API_KEY. [SendGrid provider] 2) Set the env var on Railway (server)
- Go to your Railway project → select the server service → Settings → Variables.
- Add SENDGRID_API_KEY with your actual SendGrid API key. [SendGrid provider]
- While you’re there, also ensure the other required server vars are set (DATABASE_URL via Variable Reference, WASP_WEB_CLIENT_URL, WASP_SERVER_URL, JWT_SECRET). [Deploying the Server] 3) Redeploy the server
- After adding the variable(s), trigger a new deploy (e.g., railway up for the server). [Deploying the Server] Notes: - SENDGRID_API_KEY should be on the server only (equivalent of .env.server locally), not on the client. [Providers; SendGrid provider] - If you’re not ready to configure SendGrid yet, switch the provider to Dummy during development (builds to production will fail with Dummy). [Providers] If you’ve already set SENDGRID_API_KEY, double-check it’s on the correct Railway service (server), spelled exactly as SENDGRID_API_KEY, and that the new deployment picked it up. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Aleksandar Okiljevic, 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?
Hey @Aleksandar Okiljevic , could you send what your server vars look? Without sensitive data. This is how looks mine.

@NEROX Thansk now it's working but sending mails, not working not local not in production, try with mailgun and sendgrid add keys
Hm I didn't quite get that one, what is not working for you right now?