wasp-lang / open-saas

A free, open-source SaaS app starter for React & Node.js with superpowers. Production-ready. Community-driven.
https://opensaas.sh
MIT License
6.12k stars 594 forks source link

Confusion upon email signup while waiting for the verification link #137

Open Martinsos opened 1 month ago

Martinsos commented 1 month ago

I tried signing up into my newly created open-saas app once I got it started, I signed up with email and pass, and I got a message that now I need to click on my verification link in my email.

But, of course, I got no verification link in the email, since Dummy provider is used (which I might not be aware of if I didn't know Wasp, and would probably keep checking the email).

So even though I knew I am not getting an email, I actually didn’t know what to do! What now? I looked into the terminal (which if I didn't know Wasp, I probably wouldn't have thought of), but no message there either. I guess we set the flag that no verification is needed?

So I finally tried logging in and that worked! But I would never think of trying logging in actually if I didn't know this much about Wasp, I would instead keep checking that email, and try other stuff, probably try signing again.

I think we need to tell them somehow what to do here.

Possible solution might be to print email in the terminal. But how will they know they need to look there? We can extend the message in the app that they get upon signup, regarding checking the email, so it says they are using Dummy provider and should look in their terminal, not in email. In Wasp Generator, we can potentially do this if we see that Dummy provider is used! Yeah, I think this could be cool solution.

Additionaly, I noticed we do mention in comments in main.wasp file that they should check server logs (we don’t tell them those will be in the terminal though! As a new user, I probably am not sure what "server logs" means), but I haven’t read that at this point yet, so didn’t know about this. Nor was anything printed to the terminal actually, so this comment is outdated / wrong also.

Actual Wasp user went through this confusion also: https://discord.com/channels/686873244791210014/1236335436918689832/1236335436918689832 .

vincanger commented 1 month ago

@Martinsos what if we add something to the template UI (that they will obviously delete later) that alerts them to ignore the messages and explains the Dummy email provider + email signup process?

Otherwise, the docs do explain this in a couple different sections:

  1. https://docs.opensaas.sh/guides/authentication/#email-verified-auth
  2. https://docs.opensaas.sh/guides/email-sending/#the-dummy-email-provider-for-local-dev-only

But you are right, theSKIP_EMAIL_VERIFICATION_IN_DEV=true var is set so theyre not being logged to the console (i probably changed this for e2e testing and forgot about the implications for the auth flow)

Martinsos commented 1 month ago

I made this PR as a potential part of the solution: https://github.com/wasp-lang/wasp/pull/2052 .

We can handle that one separately, as a bonus, and continue with the following in order to close this issue:

Yeah, if we do these two, I would call this solved.

@vincanger I took a quick look but couldn't figure out the best place in e2e tests where to set this env variable for each test, what would you suggest?

vincanger commented 1 month ago

ok @Martinsos I added a section on the Dummy provider to the Auth section of the "Guided Tour".

SKIP_EMAIL_VERIFICATION_IN_DEV=true has been removed from the template but remains in .github/workflows/e2e-tests.yml so that it's available to the tests in the latest commit 2c94ced5c53f7caf7b753b5a5d1026500ad914b6

Martinsos commented 1 month ago

ok @Martinsos I added a section on the Dummy provider to the Auth section of the "Guided Tour".

SKIP_EMAIL_VERIFICATION_IN_DEV=true has been removed from the template but remains in .github/workflows/e2e-tests.yml so that it's available to the tests in the latest commit 2c94ced

Ok sweet! However a question: will e2e tests work locally then? Who sets that env var for them in that situation? I am reopening issue to make sure we cover this question as it might be a potential problem.

Martinsos commented 1 month ago

I tried to hunt down the commit in which you added the info about Dummy provider, I believe it is this one: https://github.com/wasp-lang/open-saas/commit/0c7f380f9364bf843de1f88b9e2ea51efb983b0f .

Change is looking good, although I personally hit the issue before I got to read this part of the doc, so this wouldn't really do it for me. The moment I was told to go explore the app, I started exploring the both online demo app and my local app, so I tried to sign up in my local app and hit the issue.

This is however connected also with how the whole "Guided Tour" is structured and that other issue we have on that, so maybe we can call this done on this front, and I will go into that issue and comment there that we need to make sure to mention the Dummy provider before they try to sign up into their app. Ok, done that here https://github.com/wasp-lang/open-saas/issues/152#issuecomment-2129363352 .

Martinsos commented 1 month ago

Ok, this leaves us with one thing left to resolve in this issue: do e2e tests work ok locally now, in the sense that the email verification is skipped? If yes, we can close it, if not, let's fix that.

vincanger commented 3 weeks ago

@Martinsos to make sure e2e tests work locally, I though it'd be best to just instruct users to change their development env vars to suit the tests --> https://github.com/wasp-lang/open-saas/pull/184

Martinsos commented 3 weeks ago

@vincanger but that means they need to add that when running e2e tests and then again remove it when not running them? That sounds very cumbersome. Can't we instead just specify in the e2e tests themselves this env vars is set? I thought we had a mechanism for that? Right now you sepcified it for CI -> but let's sepcify it for e2e tests so it happens regardless of CI or not. That way we solved it. And you can then remove it from the CI.

vincanger commented 3 weeks ago

@Martinsos because we run the wasp app in a separate session than the e2e-tests, we have to set the env var before starting the wasp app. I could tell users to run SKIP_EMAIL_VERIFICATION_IN_DEV=true wasp start in the README, before running the e2e tests locally. Besides that, I'm not sure how else to go about setting this dynamically when running local e2e tests.

Martinsos commented 3 weeks ago

@vincanger I forgot a bit about how e2e tests are run locally, my bad! Yeah ok, I remember now that we did it this way due to different issues we had on CI vs local side. While this sounds like ideally we would need to refactor this once and for all properly, to have a single command that runs both app and tests, in the meantime, while we don't have that, the only solution is what you said: tell them, in README, that when starting web app, they need to set their env var, so SKIP_EMAIL_VERIFICATION_IN_DEV=true wasp start in the README. That is how it is right now, so that is what we need to add. In the future I hope we improve those e2e tests so they can be run in a better way.