Skip to content
Back

React Client SDK - CORS issue for Storage - port 5173 vs 5174 from localhost

  • 0
  • Web
  • Cloud
andrei-nepsis
6 Sep, 2025, 15:34

Hi I've been working on a project for a few weeks with the React Client SDK and OAuth2.0 Google login. All has been working alright, but today I've started getting some CORS errors , with a weird error related to different localhost ports in the request and the response from the server.

The calls to the appwrite Database don't fail. Only the calls to the Storage bucket fail with this CORS error. This is very strange because the app has been working until now from localhost and I cannot really identify something in my setup that would trigger this.

Many thanks. Let me know if you need additional details for diagnosing.

Browser: Brave 1.81.131 (Official Build) (arm64) / Chromium: 139.0.7258.66 (MacOS) node_modules/appwrite : "version": "18.2.0" npm 10.9.2 node v23.5.0 VITE v7.0.0

TypeScript
Access to fetch at 'https://fra.cloud.appwrite.io/v1/storage/buckets/<REDACTED>/files/<REDACTED>/download?project=<REDACTED>' from origin 'http://localhost:5173' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'http://localhost:5174' that is not equal to the supplied origin. Have the server send the header with a valid value.
TL;DR
Developers experiencing CORS issue for Storage module with React Client SDK and OAuth2.0 Google login. Errors due to different localhost ports in request and response from the server. Only Storage calls are failing. Confirmation that app was working on localhost. Browser: Brave. Possible solution: Ensure server sends 'Access-Control-Allow-Origin' header with correct value that matches origin in request.
andrei-nepsis
6 Sep, 2025, 15:54

Hmmmm it worked when using Chrome. This is very weird.

That said - why would the server return a different port?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more