Debugging Appwrite CORS Errors!
Welcome! So if you’re here it looks like you’re facing a stubborn CORS bug. Good news, although my error ended up being a niche issue, the debugging steps I used will help with most Appwrite CORs errors. So I was trying to set up the recovery password process for my website that uses Appwrite. Specifically I was setting up account.createRecovery(). But I kept getting this persistent CORS error: Cross-Origin Request Blocked Debugging Step 1: check for typos I thought, maybe there’s a typo or somethings undefined. So I console logged All 3 environmental variables (yours will likely be process.env) data from the form But nope, everything was fine on that front. Debugging Step 2: checking if the hostname was set up as a Appwrite platform Essentially this error is saying there is a mismatch between the “origin” host where the request came from and (ex: dogs.com) the domain of the server, where the request is coming from (ex: cats.com) So in the case of Appwrite, you need to tell Appwrite what strangers (domains) its allowed to talk to it. You might not have your hostname (ex: www.chewy.com) setup as a platform on Appwrite. Localhost should work by default but if you’re having this issue when using your actual domain, then this is worth a shot: go to your project click overview click on integrations and add platform if you see none there I was using local host but I tried every version of localhost and my actual domain I could think of, but no dice

Welcome! So if you’re here it looks like you’re facing a stubborn CORS bug. Good news, although my error ended up being a niche issue, the debugging steps I used will help with most Appwrite CORs errors.
So I was trying to set up the recovery password process for my website that uses Appwrite. Specifically I was setting up account.createRecovery(). But I kept getting this persistent CORS error: Cross-Origin Request Blocked
Debugging Step 1: check for typos
I thought, maybe there’s a typo or somethings undefined.
So I console logged
All 3 environmental variables (yours will likely be process.env)
data from the form
But nope, everything was fine on that front.
Debugging Step 2: checking if the hostname was set up as a Appwrite platform
Essentially this error is saying there is a mismatch between
the “origin” host where the request came from and (ex: dogs.com)
the domain of the server, where the request is coming from (ex: cats.com)
So in the case of Appwrite, you need to tell Appwrite what strangers (domains) its allowed to talk to it. You might not have your hostname (ex: www.chewy.com) setup as a platform on Appwrite. Localhost should work by default but if you’re having this issue when using your actual domain, then this is worth a shot:
go to your project
click overview
click on integrations and add platform if you see none there
I was using local host but I tried every version of localhost and my actual domain I could think of, but no dice