appwrite / sdk-for-web

[READ-ONLY] Official Appwrite Web SDK 🧑
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
271 stars 58 forks source link

πŸ› Bug Report: Node dependencies prevent SSR (like Remix) on Cloudflare Pages #85

Closed jgentes closed 1 month ago

jgentes commented 5 months ago

πŸ‘Ÿ Reproduction steps

Using https://github.com/Meldiron/appwrite-ssr-remix from @Meldiron, replace @remix-run/node with @remix-run/cloudflare.

The workaround (for Node) is to use installGlobals as seen in https://github.com/Meldiron/appwrite-ssr-remix/blob/main/server.ts, however this is not available for Cloudflare as Workers use the V8 runtime.

πŸ‘ Expected behavior

The client should not use isomorphic libraries, and instead determine which libraries to use based on the platform. <-- guessing here

πŸ‘Ž Actual Behavior

Using import { Client } from 'appwrite' in a server file will cause Uncaught ReferenceError: window is not defined due to the use of node_modules/isomorphic-form-data/lib/browser.js which does not work on edge (Workers). Pages is built on Workers, so it prevents deployment.

🎲 Appwrite version

Version 0.10.x

πŸ’» Operating system

Linux

🧱 Your Environment

No response

πŸ‘€ Have you spent some time to check if this issue has been raised before?

🏒 Have you read the Code of Conduct?

eldadfux commented 2 months ago

Update: we have a pending PR with a fix for this here: https://github.com/appwrite/sdk-generator/pull/799

stnguyen90 commented 1 month ago

https://www.npmjs.com/package/node-appwrite/v/12.1.0-rc.4 is now available.

stnguyen90 commented 1 month ago

Closing as a duplicate of https://github.com/appwrite/sdk-for-web/issues/53