
Hi, I'm developing a Chrome Extension using Svelte and Appwrite. However, when I try to execute a cloud Function, I always get the following error: AppwriteException: XMLHttpRequest is not defined
This is my code try { // Verify tabs is not empty if (!tabs || tabs.length === 0) { throw new Error("Tabs is empty"); }
// Verify tabs is not empty
if (tabs.length > 100) {
throw new Error("Tabs is too long");
}
const execution = await this.functions.createExecution(
'FUNCTION-ID',
JSON.stringify({ tabs }),
true,
'/',
'POST',
{ 'Access-Control-Allow-Origin': '*' }
)
console.log(execution);
return execution;
} catch (error: any) {
console.error("Error creating execution", error);
throw error;
}
I've read that Chrome Extensions only support Fetch, does the Appwrite SDK still use XHR? Any Ideas why this might be happening? Thanks :)

It uses cross fetch to work server-side and client side: https://github.com/appwrite/sdk-for-web/blob/ca8cb1d9f2c0393ec99c7d5cb50f3be543987918/src/client.ts#L2

Thank you so much, that seemed to be the Issue. I was able to solve it by overriding the cross-fetch version to 4.0, but that brings it's own challenges. So I think for now I'm just gonna use normal fetch instead of the SDK.

[CLOSED] AppwriteException: XMLHttpRequest is not defined
Recommended threads
- Appwrite functions can't connect to data...
I'm trying to create a function that queries my database, but all database operations timeout from within the function, even though CLI access works perfectly. ...
- Sharing cookies
Hi, I’m using Appwrite Cloud, and I have a setup where my Appwrite backend is hosted on a subdomain (e.g., api.example.com), while my frontend (Next.js app) and...
- Custom Domain Issue
i have added a custom domain about 21 hours ago, but till now there is no SSL certificate is active on it. but if i do DNS check via https://dnschecker.org/#C...
