W
Waspā€¢3mo ago
Trigaten

Failed to load resource: A server with the specified hostname could not be

I deployed my app and am able to navigate to the webpage: https://my-wasp-app-client-damp-snowflake-7739.fly.dev However, I get this error repeatedly in the console. Have googled extensively. I cant sign in or do any of the app functionalities behind the auth.
21 Replies
kapa.ai
kapa.aiā€¢3mo ago
Hi @Trigaten. 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 your client is not able to communicate with the server. This could be due to a variety of reasons such as incorrect environment variables, CORS errors, or issues with the server deployment. Here are a few steps you can take to troubleshoot this issue: 1. Check your environment variables: Ensure that you have correctly set the WASP_WEB_CLIENT_URL environment variable on your server. This should be the URL of your deployed client. You can set this variable by running flyctl secrets set WASP_WEB_CLIENT_URL=<url_of_deployed_client> (source (https://wasp-lang.dev/docs/advanced/deployment/manually#deploy-to-a-flyio-app)). 2. Check for CORS errors: If your server is configured to only accept requests from a specific origin, it might reject requests from your client if the origins don't match. You can check for CORS errors in your browser's console (source (https://discord.com/channels/686873244791210014/1201898985300971540)). 3. Check your server logs: You can view your server logs by running flyctl logs (source (https://wasp-lang.dev/docs/advanced/deployment/manually#deploy-to-a-flyio-app)). This might give you more information about what's going wrong. 4. Redeploy your app: Sometimes, redeploying your app can solve the issue. You can do this by running wasp deploy fly deploy (source (https://discord.com/channels/686873244791210014/1201898985300971540)). 5. Upgrade your Wasp version: If you're using an older version of Wasp, upgrading to the latest version might solve the issue. You can do this by running curl -sSL <https://get.wasp-lang.dev/installer.sh> | sh and updating the Wasp version in your main.wasp file (source (https://discord.com/channels/686873244791210014/1201898985300971540)). If none of these steps solve your issue, please provide more information about your setup and the exact error message you're seeing. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Trigaten, 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?
sion0921
sion0921ā€¢3mo ago
check fly.io for error logs specifically server errors
Trigaten
TrigatenOPā€¢3mo ago
I have been looking at them, one sec
Trigaten
TrigatenOPā€¢3mo ago
Look pretty good to me, will look at client
Trigaten
TrigatenOPā€¢3mo ago
STRIPE_API_KEY not found, but that shouldnt kill build I also see XMLHttpRequest cannot load https://my-wasp-app-damp-snowflake-7739-server.fly.dev/auth/me due to access control checks. in my web terminal now
Trigaten
TrigatenOPā€¢3mo ago
Client is maybe having issues, but looks fine
Trigaten
TrigatenOPā€¢3mo ago
I wonder if its related to leaving my app as default name my-wasp-app
Trigaten
TrigatenOPā€¢3mo ago
šŸ™‚
No description
MEE6
MEE6ā€¢3mo ago
Wohooo @Trigaten, you just became a Waspeteer level 1!
Trigaten
TrigatenOPā€¢3mo ago
Im gonna try rerunning everything with a unique name
miho
mihoā€¢3mo ago
Wasp CLI doesn't handle the case where the Fly app name is taken (obv somebody used my-wasp-app) and because of that it doesn't set the env vars properly - as we already talked on Github šŸ˜‚ I'd advise you to: 1. Delete the TOML files from your app dir 2. Delete the Fly apps 3. Rerun the process šŸ™‚
Trigaten
TrigatenOPā€¢3mo ago
ty!
miho
mihoā€¢3mo ago
Good luck, report back how it goes šŸ™‚
Trigaten
TrigatenOPā€¢3mo ago
Ah that was you, ty again will do Interesting, so reran, and don't get that error anymore, but when I go to one of the pages (https://pub-adjust-client.fly.dev/audio-upload), I get this:
[Error] Origin https://pub-adjust-client.fly.dev is not allowed by Access-Control-Allow-Origin. Status code: 502
[Error] XMLHttpRequest cannot load https://pub-adjust-server.fly.dev/auth/me due to access control checks.
[Error] Failed to load resource: Origin https://pub-adjust-client.fly.dev is not allowed by Access-Control-Allow-Origin. Status code: 502 (me, line 0)
[Error] Origin https://pub-adjust-client.fly.dev is not allowed by Access-Control-Allow-Origin. Status code: 502
[Error] XMLHttpRequest cannot load https://pub-adjust-server.fly.dev/auth/me due to access control checks.
[Error] Failed to load resource: Origin https://pub-adjust-client.fly.dev is not allowed by Access-Control-Allow-Origin. Status code: 502 (me, line 0)
Notably, while building I saw this in terminal:
> Launching new machine
No machines in group app, launching a new machine
> Machine 1781564ef036d8 [app] was created
āœ” Machine 1781564ef036d8 [app] update finished: success

WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
- 0.0.0.0:8080
Found these processes inside the machine with open listening sockets:
> Launching new machine
No machines in group app, launching a new machine
> Machine 1781564ef036d8 [app] was created
āœ” Machine 1781564ef036d8 [app] update finished: success

WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
- 0.0.0.0:8080
Found these processes inside the machine with open listening sockets:
I may need to reset a bunch of keys, one sec Failed to load resource: the server responded with a status of 401 () https://pub-adjust-server.fly.dev/auth/me Seeing this in web terminal In server logs, I see this on page load: GET /auth/me 401 4.297 ms - 43 then this when i try to login:
POST /auth/email/login 500 138.080 ms - 148
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] PrismaClientKnownRequestError:
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] Invalid `prisma.authIdentity.findUnique()` invocation:
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] The table `public.AuthIdentity` does not exist in the current database.
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at Rn.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:174:7325)
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at Rn.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:174:6754)
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at Rn.request (/app/node_modules/@prisma/client/runtime/library.js:174:6344)
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at login (/app/.wasp/build/server/src/auth/providers/email/login.ts:23:30)
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at <anonymous> (/app/.wasp/out/sdk/wasp/server/utils.ts:26:5)
POST /auth/email/login 500 138.080 ms - 148
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] PrismaClientKnownRequestError:
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] Invalid `prisma.authIdentity.findUnique()` invocation:
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] The table `public.AuthIdentity` does not exist in the current database.
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at Rn.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:174:7325)
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at Rn.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:174:6754)
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at Rn.request (/app/node_modules/@prisma/client/runtime/library.js:174:6344)
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at login (/app/.wasp/build/server/src/auth/providers/email/login.ts:23:30)
2024-10-03T20:23:29.999 app[1781564ef036d8] mia [info] at <anonymous> (/app/.wasp/out/sdk/wasp/server/utils.ts:26:5)
Everything works locally, im basically just copying yalls free saas example. Will keep investigating.
Trigaten
TrigatenOPā€¢3mo ago
@miho any ideas here?
Trigaten
TrigatenOPā€¢3mo ago
This seems like a potential problem with wasp/the template. Signing off for today. Thanks for your help @miho .
miho
mihoā€¢3mo ago
Did you run wasp db migrate-dev and created the migrations? Without this things can't work šŸ˜„ That's what the errors are saying "there is no AuthIdentity in the database" which is an Wasp model for auth. I'd advise going through Wasp's tutorial just to get the hang of things so you can speed up your learning process šŸ™‚ https://wasp-lang.dev/docs/tutorial/create
1. Creating a New Project | Wasp
You'll need to have the latest version of Wasp installed locally to follow this tutorial. If you haven't installed it yet, check out the QuickStart guide!
Trigaten
TrigatenOPā€¢3mo ago
I did not. I went thru those docs somewhat before, but not sure if I would have known to migrate (limited webdev experience). tysm, ill go through them fully now
MEE6
MEE6ā€¢3mo ago
Wohooo @Trigaten, you just became a Waspeteer level 2!
Trigaten
TrigatenOPā€¢3mo ago
It looks like this problem is fixed. Im having a diff problem with mailgun, looking into that. Ill update here when done. @miho letting you know that I (mostly you šŸ™‚ ) have now solved this. Here is where I went wrong: - used the default app name on deploy - didn't know the perform migrate The first was very avoidable. For the second, I didn't see it noted on the deploy page, and even having done the tutorial might not have known to do it. It might be worth clarifying these further in the docs to help unexperienced devs like myself. I am happy to make a PR if you are interested šŸ™‚
miho
mihoā€¢3mo ago
Thank you for the feedback! šŸ™‚ This helps us a lot to know which pieces of the docs could be improved.
The first was very avoidable.
Ideally, we'd tell you - "hey, the app name is taken" - but this is something waiting to be implemented, sooner than later.
I am happy to make a PR if you are interested
Please do - either make a PR with exact changes you think would be useful - or if it's too much, just add more info here and we'll update the docs based on your feedback.
Want results from more Discord servers?
Add your server