visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.88k stars 1.35k forks source link

[Bug] CORS Error on electron #2342

Closed Clamb94 closed 10 months ago

Clamb94 commented 10 months ago

Description

Hi, I'm getting multiple CORS errors on my electron react app for windows when using react-map-gl. The map is actually loading fine and seemingly working fine as well, but my log shows these errors:

Access to fetch at 'https://events.mapbox.com/events/v2?access_token=TOKEN' from origin 'http://localhost:1212' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. AND mapbox-gl.js:31 POST https://events.mapbox.com/events/v2?access_token=TOKEN net::ERR_FAILED 204

Any idea how to solve this? I can't change the request's mode to 'no-cors' as recommended by the error, since the request is done by the react-map-gl lib.

When trying to enable 3D Terrain, I'm getting similar errors constantly and most of the time the 3D Terrrain is not working

Environment

Pessimistress commented 10 months ago

The error is from mapbox-gl, you should ask in Mapbox's repo.