Authentication Issues Live

Latest Wasp on WSL, using Open SaaS
Google login/email login etc. works on local host perfectly fine. (wasp start) Testing on live website on a custom domain Having authentication issues on live that is preventing identification of if I am logged in or not. Thus, not showing log in and log out button.
Access to XMLHttpRequest at 'https://gulearn-server.fly.dev/auth/me' from origin 'https://grulearning.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
gulearn-server.fly.dev/auth/me:1

Failed to load resource: net::ERR_FAILED
grulearning.com/:1 Access to XMLHttpRequest at 'https://gulearn-server.fly.dev/auth/me' from origin 'https://grulearning.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Access to XMLHttpRequest at 'https://gulearn-server.fly.dev/auth/me' from origin 'https://grulearning.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
gulearn-server.fly.dev/auth/me:1

Failed to load resource: net::ERR_FAILED
grulearning.com/:1 Access to XMLHttpRequest at 'https://gulearn-server.fly.dev/auth/me' from origin 'https://grulearning.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Attached are the fly.io server logs & console log on website.
21 Replies
kapa.ai
kapa.ai2mo ago
Hi @Joshua. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message you're seeing indicates a Cross-Origin Resource Sharing (CORS) issue. This typically happens when a web application tries to access resources from a different domain, protocol, or port than its own. In your case, it seems like your server is not properly configured to accept requests from your client's domain (<https://grulearning.com>). To resolve this issue, you need to set your domain as the WASP_WEB_CLIENT_URL environment variable for your server app. This is done to keep your CORS configuration up to date. Here's how you can do it:
wasp deploy fly cmd --context server secrets set WASP_WEB_CLIENT_URL=<https://grulearning.com>
wasp deploy fly cmd --context server secrets set WASP_WEB_CLIENT_URL=<https://grulearning.com>
Make sure to replace <https://grulearning.com> with your actual domain. After setting the WASP_WEB_CLIENT_URL, redeploy your application and the issue should be resolved. If you're using an external authentication method like Google or GitHub, make sure to additionally set the necessary environment variables specifically required by these methods. You can check the specific documentation for Google (https://wasp-lang.dev/docs/auth/social-auth/google#4-adding-environment-variables) or GitHub (https://wasp-lang.dev/docs/auth/social-auth/github#4-adding-environment-variables) for more details. For more information, you can refer to the Wasp documentation on setting up a custom domain (https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Joshua, 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?
Joshua
Joshua2mo ago
wasp deploy fly cmd --context server secrets set WASP_WEB_CLIENT_URL=https://mycoolapp.com With my correct domain name Re deployed and same problem, I may have multiple domains as an issue, how can I remove a domain? @kapa.ai
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- To remove a domain from your Fly.io application, you can use the flyctl command-line tool. Here's the command you would use:
flyctl domains remove <domain> --app <appname>
flyctl domains remove <domain> --app <appname>
Replace <domain> with the domain you want to remove and <appname> with the name of your Fly.io application. After removing the unwanted domain, you can then set the correct domain as the WASP_WEB_CLIENT_URL environment variable and redeploy your application. Please note that the information about removing a domain is not directly mentioned in the provided knowledge sources. For more detailed instructions, you might want to refer to the Fly.io documentation (https://fly.io/docs/reference/flyctl/). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Joshua, 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?
Joshua
Joshua2mo ago
@kapa.ai how can i see other domains present on flyctl
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- To see the list of domains associated with your Fly.io application, you can use the flyctl command-line tool with the domains list command. Here's how you can do it:
flyctl domains list --app <appname>
flyctl domains list --app <appname>
Replace <appname> with the name of your Fly.io application. This command will display a list of all the domains that are currently associated with your application. Please note that the information about listing domains is not directly mentioned in the provided knowledge sources. For more detailed instructions, you might want to refer to the Fly.io documentation (https://fly.io/docs/reference/flyctl/). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Joshua, 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?
Joshua
Joshua2mo ago
@kapa.ai What subdirectory should I be in to use flyctl domains list --app <appname> I used it in my appname/app file as well as appname/app/.wasp/build file
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you. One moment! :books:
MEE6
MEE62mo ago
Wohooo @Joshua, you just became a Waspeteer level 3!
kapa.ai
kapa.ai2mo ago
---------------------- The flyctl domains list --app <appname> command does not require you to be in a specific directory. It interacts with the Fly.io API to fetch information about your application, so you can run it from any location in your terminal. Just replace <appname> with the name of your Fly.io application. For example, if your application name is my-wasp-app, you would run:
flyctl domains list --app my-wasp-app
flyctl domains list --app my-wasp-app
Please note that the information about listing domains is not directly mentioned in the provided knowledge sources. For more detailed instructions, you might want to refer to the Fly.io documentation (https://fly.io/docs/reference/flyctl/). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Joshua, 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?
Joshua
Joshua2mo ago
@kapa.ai I receive this error: sage: flyctl domains list [org] [flags] Flags: -h, --help help for list -j, --json JSON output Global Flags: -t, --access-token string Fly API Access Token --debug Print additional logs and traces --verbose Verbose output Error: unknown flag: --app
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- I apologize for the confusion. It seems there was a misunderstanding. The correct command to list the domains associated with your Fly.io application is:
flyctl domains list -a <appname>
flyctl domains list -a <appname>
Replace <appname> with the name of your Fly.io application. The -a flag is used to specify the application name. Please note that the information about listing domains is not directly mentioned in the provided knowledge sources. For more detailed instructions, you might want to refer to the Fly.io documentation (https://fly.io/docs/reference/flyctl/). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Joshua, 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?
Joshua
Joshua2mo ago
@kapa.ai I receive this error when I use the command flyctl domains list -a <appname> Error: unknown shorthand flag: 'a' in -a
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- I apologize for the confusion. It seems there was a misunderstanding. The flyctl command to list domains does not require the -a flag. The correct command to list the domains associated with your Fly.io application is:
flyctl domains list <appname>
flyctl domains list <appname>
Replace <appname> with the name of your Fly.io application. Please note that the information about listing domains is not directly mentioned in the provided knowledge sources. For more detailed instructions, you might want to refer to the Fly.io documentation (https://fly.io/docs/reference/flyctl/). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Joshua, 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?
Joshua
Joshua2mo ago
So the problem I'm running in debugging this is that fly.io docs all show fly not flyctl commands and don't work 1:1 (per https://fly.io/docs/networking/custom-domain/) I would like to just check how fly is deploying it (which domains, secrets, certs, etc.), as I know I changed custom domains and maybe it's trying to connect my backend to the first of the websites. It seems that "Whenever flyctl is run, it will look for a fly.toml file in the current directory and use the application name in that file. This behavior can be overridden by using the -a flag to set the application name, or on some commands (such as deploy) by using a -c flag to point to a different fly.toml file." got it. So i need to be in .wasp/build when doing this, as the one in my appname/app is the fly.toml I copied out per directions in set-up But -a should override it... but -a isn't being recognized?
Joshua
Joshua2mo ago
No longer receiving cors errors, but the login option is not showing When I go to login (manually to login url) and try logging in I get pending requests, but no cors.
No description
Joshua
Joshua2mo ago
And I resolved it... So I had to manually through fyctl update everything
Joshua
Joshua2mo ago
@kapa.ai to make things work I directly typed to command prompt the following (with my keys) flyctl secrets set GOOGLE_CLIENT_ID=your_google_client_id flyctl secrets set GOOGLE_CLIENT_SECRET=your_google_client_secret flyctl secrets set SENDGRID_API_KEY=your_sendgrid_api_key flyctl secrets set GOOGLE_CLIENT_ID=your_google_client_id It also may have been this (was an error on deployment/live server saying npm out of date): npm install -g npm@10.5.1 Well, I can login via google with a new email, but if I log in with an existing user I now get the error: Save failed: user with the same identity already exists My database logs is saying user already exists out... But, I'm logging in, not creating an account. I'll continue to take a crack at this tomorrow. Sleeping time for now.
No description
No description
No description
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The error message "Save failed: user with the same identity already exists" typically occurs when you try to sign up or log in with an email that's already associated with an existing user in your database. This issue can occur in a couple of scenarios: 1. If you're trying to sign up with an email that's already in use. In this case, the solution would be to use a different email or log in with the existing account. 2. If you're trying to log in with a social login (like Google) using an email that's already associated with an existing account created with a different method (like email and password). In this case, you would need to delete the existing user from your database and try logging in again. You can do this by running wasp db studio and manually deleting the user (source (https://discord.com/channels/686873244791210014/1208366712450195466)). If you're still encountering this issue after checking these scenarios, it might be a bug in the Wasp authentication system. In this case, I would recommend creating an issue in the Wasp GitHub repository (https://github.com/wasp-lang/wasp/issues) to get help from the Wasp team. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Joshua, 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?
miho
miho2mo ago
Good bot! Let me go through the thread and see if I can give you some advice as well 🙂
miho
miho2mo ago
1️⃣ Here's what we found worked for us when using custom domains with Fly: https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app 1. Create a new cert for the domain on Fly 2. Updated the A and/or AAAA DNS records for the domain 3. Making sure to update env var WASP_WEB_CLIENT_URL to make sure CORS is working It's okay if you have multiple domains on Fly IMHO, the way you point it to a project is by doing the A and AAAA DNS records. 2️⃣ As for the "error: Save failed: user with the same identity already exists" error, this one feels more serious to me! I'd like to dig into it. Please help me understand what steps did you take. Did you signup with email and then Google? Do you save the email on the User entity object? @Vinny (@Wasp) is this then expected, until we have account merging logic a single email can't be used for two accounts?
Deploying with the Wasp CLI | Wasp
Wasp CLI can deploy your full-stack application with only a single command.
Vinny (@Wasp)
Vinny (@Wasp)2mo ago
2️⃣ yes, the email field on the user entity is unique by default in Open SaaS, so if you log in with Github and then Google, and these use the same email address, for example, the log in will fail