Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/databases' has been blocked by CORS policy
- 1
- Databases
- Web

Method PATCH is not allowed by Access-Control-Allow-Methods in preflight response.
const likeProposal = async () => {
const response = await databases.updateDocument(databaseId, proposalCollection, proposal.$id, {
...proposal,
likes: Number(proposal.likes) + 1,
})
console.log(response)
}

This vid goes through a few of the common CORS errors that a lot of our devs see, give it a shot here: https://www.youtube.com/watch?v=oEpRh9H5l5g

Same error

What's all the code?

I've also change the hostname in my console to be a wildcard but I'm still getting the same error

Is this cloud or self-hosted?

error or my actual code?

cloud

Both

All the code related to appwrite and all the errors

Access to XMLHttpRequest at 'https://cloud.appwrite.io/v1/databases' has been blocked by CORS policy
Method PATCH is not allowed by Access-Control-Allow-Methods in preflight response.
Uncaught (in promise) AppwriteException: Network request failed

const likeProposal = async () => {
const response = await databases.updateDocument(databaseId, proposalCollection, proposal.$id, {
...proposal,
likes: Number(proposal.likes) + 1,
})
console.log(response)
}

this is the only code related to appwrite that is failing

So everything works except that?

yes

Do you have some relationships?

no

And do you have set edit permissions?

yes, i have permission to create, read, update and delete set to any
in my console

i got this when i hovered over the updateDocument function in vscode
Update document
Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
@throws — {AppwriteException}
what's the patch method?

I think the doc ID is not correct or some of the data in the payload. Maybe ..proposal sin't correct?

I just ran my application with firefox and it worked perfectly, but it's not working in chrome

Thanks @Evdog and @D5 the error was caused by an extension I installed in chrome
Recommended threads
- Oauth2-Error 400Invalid `success` param:...
My code: > await new Account(client).createOAuth2Session(OAuthProvider.Google, 'https://www.mydomain.online/home', 'https://www.mydomain.online'); I ha...
- Issue with `listDocuments` when using qu...
Hello, Appwrite team! I'm having an issue with `listDocuments` when using query modifiers: **Environment:** - Self-hosted Appwrite (`Version 1.4.13`) installe...
- Function gives unauthorized error when w...
I am on free tier. I have function that has three attributes: 1. A stand alone attribute (required) 2. A many to one relationship attribute 3. A many to man...
