Back

Problem accessing api via local host.

  • 0
  • Users
  • Cloud
justus
3 Mar, 2024, 15:54

I think i set the Endpoint correctly in my config.ts als the cloud.appwrite url but when i try to create a user I get this Error message: Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/account' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. api.ts:17 AppwriteException: Network request failed at Client.<anonymous> (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=1b18edb2:862:15) at Generator.throw (<anonymous>) at rejected (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=1b18edb2:495:32) SignupForm.tsx:33 AppwriteException: Network request failed at Client.<anonymous> (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=1b18edb2:862:15) at Generator.throw (<anonymous>) at rejected (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=1b18edb2:495:32) api.ts:8

TypeScript
   POST https://cloud.appwrite.io/v1/account net::ERR_FAILED 404 (Not Found)
TL;DR
Developers are having trouble accessing an API via localhost due to CORS policy blocking the request. The error message indicates a missing 'Access-Control-Allow-Origin' header. To fix this, add the appropriate CORS configuration to the API.
Steven
3 Mar, 2024, 15:56

Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

Steven
3 Mar, 2024, 15:57

What version of the SDK do you have?

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