Trouble deploying opensaas on fly.io, get a site not found after using authentication
I deployed my project on fly.io and did everything exactly according to the documentation. However, trying to click on google authentication I will get a site not found (https://mycoolap-server.fly.dev/auth/google/login) and when trying to sign up by mail I get network error (using the console also shows me, that the same link is trying to be opened)
What am I missing here?
29 Replies
Hi @samim. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It seems like you're experiencing issues with your deployment on Fly.io, specifically with Google authentication and email sign-up. Here are a few things you could check:
1. Environment Variables: Ensure that you've set all the necessary environment variables correctly. This includes the Google Client ID, SendGrid API, and any other keys required for your application. If you're using an external authentication method like Google, make sure to set the necessary environment variables required by these methods. You can check if you've added your secrets correctly by running
flyctl secrets list
in the terminal (source (https://wasp-lang.dev/docs/advanced/deployment/manually#set-up-a-flyio-app)).
2. Network Tab: Open the developer tools in your browser and check the "Network" tab. Look for any requests that are taking a long time or failing. This could indicate a problem with the server not responding (source (https://discord.com/channels/686873244791210014/1217941277979574315)).
3. Fly.io Dashboard: Check your Fly.io dashboard for any errors or issues. Look at the server logs and see if there are any errors being reported or if the server is receiving requests from the client (source (https://discord.com/channels/686873244791210014/1217941277979574315)).
4. Redeploy: Sometimes, redeploying the app can resolve the issue. A community member reported that their login tab started showing up after redeploying the app (source (https://discord.com/channels/686873244791210014/1217941277979574315)).
If you're still experiencing issues after checking these things, it might be helpful to share more details about your setup or any error messages you're seeing. This could help identify the problem more accurately.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @samim, 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?Did all that ๐ฆ
Ok, let me get a few infos from you.
I deployed my project on fly.io and did everything exactly according to the documentation.Did you follow the Wasp Lang docs? Did you use the
wasp deploy fly ...
command?
However, trying to click on google authentication I will get a site not found (https://mycoolap-server.fly.dev/auth/google/login)What are your app names on Fly?
fly apps list
will answer that.
Maybe you used an existing name and then Fly adds some random chars to the end of the name. Wasp doesn't handle this (yet) and this might have happened to you.
when trying to sign up by mail I get network error (using the console also shows me, that the same link is trying to be opened)Is CORS mentioned in the browser error? And lastly, did you set all the needed env vars for Google auth and stuff like server url and client url?
I did the wasp deploy fly deploy command. My app names are NAME OWNER STATUS LATEST DEPLOY
build-summer-silence-3967 personal suspended 21h27m ago
etal personal suspended 1h26m ago
etaldb personal deployed
fly-builder-spring-wave-6590 personal suspended actually the app wasn't exisiting, I deployed newly to fly. Cors is not mentioned in the browser error. Google auth is setup correctly, as it worked on local.
etal personal suspended 1h26m ago
etaldb personal deployed
fly-builder-spring-wave-6590 personal suspended actually the app wasn't exisiting, I deployed newly to fly. Cors is not mentioned in the browser error. Google auth is setup correctly, as it worked on local.
I did the wasp deploy fly deploy commandIt looks to me by looking at the Fly app names, that you didn't deploy the apps with
wasp deploy fly launch ...
Wasp names your apps like <app-name>-server
, <app-name>-client
and <app-name>-db
.
I'd suggest the following - delete the Fly apps you have now. Delete the local TOML files. Run the wasp deploy fly launch etal <some-region>
and see what happens ๐
This command will set up the env vars with proper URLs for you and you'll get a working deployment ๐คok, well I started a new project and did everything as you described. It looked better since it created all the three apps -server, -client and -db
but I got the same problem
I have a feeling you didn't set the
GOOGLE_
env vars on Fly? Check the live logs of the server app in the Fly dashboardin the documentation I have this wasp deploy fly launch my-wasp-app mia --server-secret GOOGLE_CLIENT_ID=<...> --server-secret GOOGLE_CLIENT_SECRET=<...> But it always gives me this error:
๐ You already have Fly toml files. The launch command is intended to be run one time on a new Fly project. Please try a different command.
Wohooo @samim, you just became a Waspeteer level 4!
Yes, you should use
wasp deploy fly cmd
to set the variables. https://wasp-lang.dev/docs/advanced/deployment/cli#environment-variables-1Deploying with the Wasp CLI | Wasp
Wasp CLI can deploy your full-stack application with only a single command.
OK, I did, thanks. Now the site is just loading...
white site
and for email authentication I still get the network error
What are the error you get? Please post the erorrs you mention, I'll be able to help you better then ๐
ok, so this is the error in the console I get when trying to signup with email authentication
and that's what I get by clicking on the Google button
This is the next piece of the puzzle, since you are using a custom domain - you need to adjust your env vars: https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app
Deploying with the Wasp CLI | Wasp
Wasp CLI can deploy your full-stack application with only a single command.
ok thanks, I did all that. I can reach my app via the custom domain. However, the authentication is still not working. I added the A and AAAA records for the etal-client IPs. did the cert thingy as well
However, the authentication is still not working.What does this mean? What do you see? What kind of errors do you get? ๐ It really pays off if you share as many details a possible ๐
ok, I am trying to give as much as I can see. The Site is calling https://etal-server.fly.dev/auth/google/login but I don't get any result page (screen stays white, see screenshot)
Go to live logs of the server app and see if you get any errors there? Go into the Fly Dashboard to see the Live Logs
So, you helped me alot. I haven't had set up the env variables for stripe, I guess that was the error. I got the authentication working now ๐ thanks a lot! But now encountered another problem with sending verification emails, eventhough I set the env variables for mailgun. see error message from live log:
ams [info] POST /auth/email/signup 200 49.615 ms - 16
2024-09-24T14:08:13.943 app[32871356a40598] ams [info] Failed to send email Error: Forbidden
2024-09-24T14:08:13.943 app[32871356a40598] ams [info] at IncomingMessage.<anonymous> (/app/node_modules/mailgun-js/lib/request.js:327:17)
2024-09-24T14:08:13.943 app[32871356a40598] ams [info] at IncomingMessage.emit (node:events:529:35)
2024-09-24T14:08:13.943 app[32871356a40598] ams [info] at endReadableNT (node:internal/streams/readable:1368:12)
2024-09-24T14:08:13.943 app[32871356a40598] ams [info] at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
2024-09-24T14:08:13.943 app[32871356a40598] ams [info] statusCode: 401
2024-09-24T14:08:13.943 app[32871356a40598] ams [info] }
2024-09-24T14:08:46.748 app[32871356a40598] ams [info] GET /auth/me 304 8.865 ms - -
Are you using the Mailgun EU region?
yes
That's a Wasp bug that we fixed and we'll release a new version in ~10 days with the fix. I hope you can wait for that.
Could I ask you to try using the SMTP email sender with Mailgun SMTP setup? I haven't tried that workaround, but it should work ๐
Or you could use SendGrid in the meantime if you don't care about using Mailgun ๐
can you tell me how I can switch to Mailgun SMTP?
never mind, I figured out.
and it works good.
Nice man! I'm glad it worked out for you ๐
did you guys fix the bug with the latest release?
Yes!
Check the releases: https://github.com/wasp-lang/wasp/releases/tag/v0.15.0
GitHub
Release v0.15.0 ยท wasp-lang/wasp
0.15.0
๐ New Features and improvements
Write your app config in TypeScript (preview feature)
Wasp 0.15.0 ships a preview feature that lets you define your app in main.wasp.ts using TypeScript inste...
awesome