API Error: Failed to fetch. Does the server allow CORS?status: undefined

Hello, as a non developer, I am attempting to fix this issue:

  1. I’ve set my AWS CORS settings to this:
    image

  2. set my apps webconfig to:
    image

  3. Get options:

My goal of this API call is to send a response with my username and password, then create a schema that i can bind on my app. I’ve read that i need to perform a GET in order to get the schema items for binding.

Any advice to help resolve this would be greatly appreciated.

Can any one help me on this? im starting to wonder about the support for appgyver

Sorry for the delay. CORS seems alright on the S3 but it’s impossible to know without actually seeing the request being made. It’s not enough that the S3 bucket has cors allowed as you’re not making the request to your S3 bucket, rather somewhere else that you’ve censored. Does this address allow CORS?

I’d look into your browser console and network tab and try to dig in what request is really made, is it valid at all and see if it’s actually blocked by cors.

Even though the error message says “Does the server allow CORS?” There’s million other reasons why the fetch could fail.

Looking closer to your configuration, you’re making a GET request to the resource with a “body” in the HTTP Header. This seems very unorthodox and is most likely not what you want to do, usually requests with a body or login in general are POST request (“Create record (POST)”) which creates a session for your account.

Anyway it’s impossible to know since I don’t know the API.

and regarding the support of AppGyver, we are doing the best we can. We are a small team, we don’t work weekends and we don’t have dedicated support people yet. Trying to keep up with the forums and helping people is definitely something we want to do but it’s a lot of work - especially now that people are having their summer vacations!

Thankful for all the patience you have. :v:

Is there any documation on that api? I get internal server error.

None, I am able to resolve that one about an hour ago. Thank you

Im facing the same issue. Can You please let me know how exactly you resolve? Thanks.

Can you send us screenshots? I’ll give it a stab once you do.

Solved.

The CORS configuration goes into the web.xml file of Apache Tomcat . We need to add the following filter

CorsFilter org.apache.catalina.filters.CorsFilter CorsFilter /*

I am getting same error for login session.
does changing in web.xml affects to other files also??

What are the other files? Can you please be more specific?

its on my cpanel
where we adding the corsfilter

Hi! Are you still having problems? Can you provide some screenshots (with whatever you need to censor is censored)?

yes, actually the server guy is not able to find the web.xml file. we added headers on server
[
header(“Content-Type:application/json”) ;
header(‘Access-Control-Allow-Origin: *’);
header(“Access-Control-Allow-Methods: POST, GET, OPTIONS”);
header(“Access-Control-Allow-Headers : Origin,Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With”);
header(“Access-Control-Allow-Credentials:true”);
]
after adding this we got HTTP2 error.
we don’t know ho to resolve this error…


Hi! Sorry for the late answer :disappointed_relieved:

Our guess would be the following: you’re using a wildcard in origin, which is not allowed when credentials are included.

Note Access-Control-Allow-Origin is prohibited from using a wildcard for requests with credentials: 'include' . In such cases, the exact origin must be provided; even if you are using a CORS unblocker extension, the requests will still fail.

Please see Using Fetch - Web APIs | MDN

Try whitelisting appgyver.com and appgyverapp.com and see if that helps!

I have the same problem attached the images and the error. Thank you

json
https://app1073942999.codejig.com/api/entity/2500006084316511496/

Did you figure out your CORS issue? I am creating a API hosted on a Tomcat server and can see the CORS headers that look right using postman but getting Error: TypeError: Failed to fetch. Does the server allow CORS?status: undefined when testing inside appgyver

Hi! With CORS issues, if it is an actual CORS issue, there is unfortunately no way around it on web, see here. The easiest way to check if it is a CORS issue is to check the developer console of your browser for the request, or checking if the request would work when you try it in mobile (preview app). If it works in mobile preview app but not in web preview app / composer, it’s a CORS issue and you have to work around it by configuring the schema by hand to Composer etc.

Hey I am facing a similar error,
I am just trying to fetch a list of records, Can you assist?