Back

Server Error When Accessing API From iOS Simulator

  • 1
  • Flutter
  • REST API
  • Cloud
Shadriarty
6 Aug, 2024, 20:54

When testing REST API calls from FlutterFlow (GUI app building service based on Flutter framework) with enabled by default proxy routing, everything works fine. When I disable proxy routing, I get this error in the browser's console: Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/account/tokens/email' from origin 'https://app.flutterflow.io' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://localhost' that is not equal to the supplied origin. When I make API calls from my app running in iOS simulator, I get this error message (raw body): {"message":"Server Error","code":500,"type":"general_unknown","version":"1.5.8"}.

My initial hypothesis was that it also has something to do with CORS policies. I tried creating different platforms in Appwrite Console, including Web app with hostnames localhost or * (general wildcard) with no luck. I also tried to create a Flutter iOS platform with my app's name and Bundle ID with no luck either.

I use no SDKs making all calls via REST API (for example, Create email token (OTP)).

Any help will be appreciated!

TL;DR
Server error when accessing API from iOS simulator due to CORS policy blocking XMLHttpRequest. Error message: "Server Error." Attempted to troubleshoot by adjusting platform settings in Appwrite Console with no success. The issue may be related to CORS policies preventing API calls. Solution: Enable proxy routing to resolve the issue.
Joshi
6 Aug, 2024, 20:57

Go to project overview then create web app

Joshi
6 Aug, 2024, 20:57

Paste this https://app.flutterflow.io in and you're good to go

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