-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Issue : - Frequent CORS Errors which Dev's building on wasp are getting #2978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hey @0xTaneja thank you for the contribution. I think this might be going too loose with security because we are effectively disabling CORS for all endpoints for all of our users. We want to be explicit in which domains we allow to connect to our server. Setting the value to I'd like us to more explicitly solve #2933 by doing something like this:
This is a rough idea, I'm not 100% about this, but I'm trying to give you an idea how we'd like the DX to look like. |
yep i agree with you @infomiho i have added |
Validating required envs -> we are actually doing this on the server side now also since recently if I am correct, check out https://wasp.sh/docs/project/env-vars#custom-env-var-validations -> we will run those checks on server start, and if a deployed server is missing env vars, it will fail with useful error message! Right @infomiho ? That said hm, I guess that error message will be logged up there into the logs on the hosting provider, and you might still be getting CORS errors from the client perspective. So that helps if you go there to see what the issue is, but you still need to konw that CORS error might not be CORS error. @infomiho pinging idea makes general sense to me -> by checking I wonder if there is some other way to go around all this? So first of all, why do we get CORS errors if server crashed / there is some 500? @0xTaneja said the following:
If that is correct, would the solution be adding Access-Control-Allow-Origin header onto errors, so that they properly get through? We still wouldn't be doing it for all respnses from our server, so no global Additionally:
|
Description
closes #2933
Select what type of change this PR introduces:
Description
Many users deploy a Wasp app, hit the client, and see CORS error in the browser console even though the real cause is a missing env-var or other 5xx on the server.
This happens because the response that bubbles up from a crashed server has no Access-Control-Allow-Origin header, so the browser rewrites the failure as a CORS issue and hides the actual JSON body.
I maybe wrong on the issue but the only problem regarding the CORS which i found out in our codebase was it,