failed to send email production app
When i try to sign up in my opensaas app it says "check email" but the server logs say:
```
POST /auth/email/signup 200 286.658 ms - 16
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] Failed to send email ResponseError: Forbidden
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] at /app/node_modules/@sendgrid/client/src/classes/client.js:146:29
2024-10-20T13:53:21.731 app[148e2444f9357] ams [info] at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] code: 403,
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] response: {
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] headers: {
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] server: 'nginx',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] date: 'Sun, 20 Oct 2024 13:53:21 GMT',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'content-type': 'application/json',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'content-length': '281',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] connection: 'close',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'access-control-allow-origin': 'https://sendgrid.api-docs.io',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'access-control-allow-methods': 'POST',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'access-control-allow-headers': 'Authorization, Content-Type, On-behalf-of, x-sg-elas-acl',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'access-control-max-age': '600',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'x-no-cors-reason': 'https://sendgrid.com/docs/Classroom/Basics/API/cors.html',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'strict-transport-security': 'max-age=600; includeSubDomains'
Cross Origin Resource Sharing (CORS) | SendGrid Docs | Twilio
CORS is a security feature of modern browsers to keep browser users secure.
10 Replies
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
My my email sender:
Email is the same as single sender in my sendgrid. Also i set my secret in my env.server
and my email is verified
----------------------
The error message you're seeing indicates that the SendGrid API is returning a
403 Forbidden
error. This typically means that the server understood the request, but it refuses to authorize it. This status is commonly returned if the request lacks valid authentication credentials for the target resource or if the provided API key is not correct.
In your main.wasp
file, you should have set the provider field to SendGrid
as shown below:
Then, you need to get the SendGrid API key and add it to your .env.server
file. Here are the steps to get the API key:
1. Go to SendGrid (https://sendgrid.com/) and create an account.
2. Go to API Keys (https://app.sendgrid.com/settings/api_keys) and create a new API key.
3. Copy the API key and add it to your .env.server
file.
Your .env.server
file should look like this:
Please ensure that you have correctly set the SendGrid API key in your .env.server
file. If the problem persists, you might want to check if the API key has the necessary permissions or if it is active.
For more information, you can refer to the Wasp documentation on using the SendGrid provider (https://wasp-lang.dev/docs/advanced/email#using-the-sendgrid-provider).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, 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?The
from
email needs to be approved on SendGrid, [email protected]
won't work unless you own the email.com
domain and verify it with SendGrid.yeah that is a placeholder i have it as my personal gmail
look it is verified
only the email is a placeholder
the email in main.wasp exactly matches the one verified here
name not tho idk if that is a must..
What's the value of
auth.email.fromField
?solved i had to scroll up and also change the email in the field there
didnt know it was even there
my bad i geuss
No worries, I'm glad it's sorted đź‘Ť