
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
- Struggling with Sessions
Understanding check: createAnonymousSession() registers the session with the backend setSession() creates a cookie on the user’s computer(?) getSession(‘curr...
- MCP and VSCode Docs
I like your tools, but would like to set up Copilot in VSCode, but these docs don't offer that guide. Did I miss something? https://appwrite.io/docs/tooling/mcp
- How to set wildcard at custom doamin
For OAuth2 redirect, I have set the appwrite api endpoint as appwrite.example.com, and added the CANME in cloudfare where I bought the domain name. And I hosted...
