W
Wasp-lang•5mo ago
7Nic

Error on sending email to veirify account

It works on localhost (Dummy, Sendgrid and SMTP), I create an account and get the token link. But when trying to create an account after deploying on Fly.io wasp deploy fly launch <name> iad it doesn't work. Here are the browser console and network. The network returned 200 for the auth/email/signup and 204 for the preflight. The console only show unauthorized (401) on /auth/me, I think this was expected since I'm not logged in yet. The server logs returned ECONNREFUSED and __node_internal_exceptionWithHostPort on the port 587. That's not the port I configured in the .env.server file
No description
No description
No description
37 Replies
kapa.ai
kapa.ai•5mo ago
Hi @7Nic. 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 information provided, it seems like there might be an issue with your email sending configuration after deploying your Wasp application on Fly.io. Here are a few things you can check: 1. Environment Variables: Ensure that the environment variables related to your email sending service (like Sendgrid) are correctly set in the .env.server file and that these values are correctly deployed to your Fly.io environment. Docs > Auth > Social-auth > Google > Setting up Google Auth > 4. Adding Environment Variables (https://wasp-lang.dev/docs/auth/social-auth/google#4-adding-environment-variables) 2. Server Logs: Check the server logs on Fly.io for any errors or warnings that might indicate what's going wrong. You can do this by going to your server on Fly and looking at what is being printed there. Discord support thread: My login tab on the frontpage went missing after deployment on fly.io > Answers Part 2 (https://discord.com/channels/686873244791210014/1217941277979574315) 3. Network Tab: Check the "Network" tab in your browser's developer tools to see if requests to the server are taking a long time or failing. Discord support thread: My login tab on the frontpage went missing after deployment on fly.io > Answers Part 2 (https://discord.com/channels/686873244791210014/1217941277979574315) If you're still having trouble, you might want to consider creating a new issue in the Wasp Github repository or asking for help in the Wasp Discord community. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @7Nic, 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?
7Nic
7NicOP•5mo ago
When redeploying using SendGrid instead of SMTP I get other error (see logs in the file)
7Nic
7NicOP•5mo ago
miho
miho•5mo ago
Did you set the env variables on the Fly server app with your SendGrid credentials?
7Nic
7NicOP•5mo ago
hmm, you mean like here in the docs? https://wasp-lang.dev/docs/advanced/deployment/cli#environment-variables-1 No, I'll try these
No description
miho
miho•5mo ago
Yep 😄 all the needed variables Could you check the server logs on Fly as well?
7Nic
7NicOP•5mo ago
hahah Can I have a list of what exactly variables are needed to set on the command? Some env variables are not needed in the desploy command, right?
MEE6
MEE6•5mo ago
Wohooo @7Nic, you just became a Waspeteer level 1!
7Nic
7NicOP•5mo ago
It didn't work. I put all .env.server variables in the command wasp deploy fly launch <name> iad --server-secret STRIPE_KEY=mykey SENDGRID_API_KEY=mykey ....... Here are the server logs
miho
miho•5mo ago
Maybe you need to auth your domain here: https://app.sendgrid.com/settings/sender_auth
SendGrid
Delivering your transactional and marketing email through one reliable platform.
No description
7Nic
7NicOP•5mo ago
The email was sent (thank you!!) But, for some reason I'm getting Invalid credentials. :sadboi: :sadboi: I noticed it started to happen on localhost as well. I get the link with the token, when I click I got the success validation message. But, when trying to login (with the same password) I got this error. The weird thing is, if I reset the password, the login works.
No description
neogeofun
neogeofun•5mo ago
@7Nic Noticed this myself. Wasn't focusing on this since I thought it might be some issue with local development. Does it happen on production too?
7Nic
7NicOP•5mo ago
Yes, both local and production. Started happening after some changes.
neogeofun
neogeofun•5mo ago
Some changes on your end, or Wasp?
7Nic
7NicOP•5mo ago
My code, I used the option [3] of wasp new command and started from there. But since authentication flows are in wasp side, I don't understand why this is happening.
neogeofun
neogeofun•5mo ago
Can you do wasp db reset to wipe out the database on local and try again?
7Nic
7NicOP•5mo ago
When I run this command, it just "explains" what is does, like a --help flag or invalid command. It does not start reset
No description
neogeofun
neogeofun•5mo ago
yeah... happens to me too wonder why reset isn't working
7Nic
7NicOP•5mo ago
I'll create another error since this was solved
neogeofun
neogeofun•5mo ago
No So wasp db reset might be a good one, but the login issue is resolved once I manually deleted the user from the database. Verified email verification works as well. Try deleting the problematic account from Prisma studio, then try to register with the same email and see if it happens again.
7Nic
7NicOP•5mo ago
Nope, it didn't work :sadboi: I wish someone could explain the flow I little bit better than the docs so I could figure out the reason
neogeofun
neogeofun•5mo ago
Were you able to delete your user through the studio?
MEE6
MEE6•5mo ago
Wohooo @neogeofun, you just became a Waspeteer level 3!
neogeofun
neogeofun•5mo ago
Delete the user (to do this you may need to delete other rows in other tables if they are related to the user) then do wasp clean and wasp start register again, click the verification on terminal make sure to hand type password on the login page (in case Chrome is autofilling a wrong password) you also need to delete auth and auth identity of user that you are deleting
7Nic
7NicOP•5mo ago
I don't really know why, but I deleted every record from all tables, typed the password by hand and it didn't work I don't know if is the databases, because it's not working after deploy (empty databases)
neogeofun
neogeofun•5mo ago
Interesting, I don't have a deployment yet, but the issue no longer happens on local.
7Nic
7NicOP•5mo ago
hey, @miho , can u help here buddy? 😅
miho
miho•5mo ago
1. wasp db reset not working is a bug we fixed in the next version of Wasp, sorry about that 😄 2. @7Nic you start from an empty DB, create an account, verify the email and then when you try to login you get "Invalid credentials"? Do you get any server errors in the terminal?
7Nic
7NicOP•5mo ago
Actually the problem does not happen if I start from "scratch" wasp new, only the project I was working on. But I tried what you said, deleted every record on every table using db studio, then tried to create an account. No errors on server side, only status 401 when logging in.
No description
miho
miho•5mo ago
Did you click the link? I don't see the backend request in the logs being logged
7Nic
7NicOP•5mo ago
yes, I did. This is the page (translated)
No description
7Nic
7NicOP•5mo ago
So when the link is clicked, it should be a log in server side, ok. I think we are narrowing the problem... Do I necessarily have to use the <VerifyEmailForm> component?
7Nic
7NicOP•5mo ago
No description
miho
miho•5mo ago
Absolutely you have to 😃 It's necessary since it communicates with the backend
7Nic
7NicOP•5mo ago
Wow, it was that! It worked finally!! Thanks a lot!! :be: I was just trying to translate How can I translate the text, since this component is "closed", it's generated by wasp compiling... For now I'm wrapping this component in a hidden divso it can communicate with the server. But, I wish it could have a proper way to change the text, maybe a prop in the component... Is there any plans to do that in the future?
miho
miho•5mo ago
That's an open issue for us! To support i18n out the box so you could simply change all the texts.
7Nic
7NicOP•5mo ago
I see, thanks for the help!!
Want results from more Discord servers?
Add your server