sdk-for-node icon indicating copy to clipboard operation
sdk-for-node copied to clipboard

🚀 Feature: Add support for Cloudflare Pages

Open shyakadavis opened this issue 11 months ago • 5 comments

🔖 Feature description

Hello;

Thanks again for Appwrite; really neat project, with awesome docs too.

So, after introducing SSR capabilities, I was finally getting started on my SvelteKit project, and followed along with how this sdk is the one to use for SSR.

Currently, deploying my project to Cloudflare Pages breaks everything since CF isn't a true node runtime, and doesn't support some modules. I know from the name itself this is a node sdk, but I was hoping to hear of a solution and/or alternatives in order to have SSR in my app.

There are currently Error: Bundling with esbuild failed with 29 errors in different files that crash everything. Here is a list of inaccessible modules and file source:

  • os (File: node-appwrite/lib/client.js)
  • url (File: node-appwrite/lib/client.js)
  • fs (File: node-appwrite/lib/inputFile.js)
  • fs (File: node-appwrite/lib/services/account.js)
  • fs (File: node-appwrite/lib/services/avatars.js)
  • fs (File: node-appwrite/lib/services/databases.js)
  • fs (File: node-appwrite/lib/services/functions.js)
  • fs (File: node-appwrite/lib/services/graphql.js)
  • fs (File: node-appwrite/lib/services/health.js)
  • fs (File: node-appwrite/lib/services/locale.js)
  • fs (File: node-appwrite/lib/services/messaging.js)
  • fs (File: node-appwrite/lib/services/storage.js)
  • fs (File: node-appwrite/lib/services/teams.js)
  • fs (File: node-appwrite/lib/services/users.js)
  • net (File: undici/lib/client.js)
  • http (File: undici/lib/client.js)
  • net (File: undici/lib/core/connect.js)
  • tls (File: undici/lib/core/connect.js)
  • http (File: undici/lib/core/util.js)
  • net (File: undici/lib/core/util.js)
  • querystring (File: undici/lib/core/util.js)
  • worker_threads (File: undici/lib/fetch/constants.js)
  • zlib (File: undici/lib/fetch/index.js)
  • http (File: undici/lib/fetch/index.js)
  • perf_hooks (File: undici/lib/fetch/util.js)
  • http (File: undici/lib/mock/mock-utils.js)
  • console (File: undici/lib/mock/pending-interceptors-formatter.js)
  • url (File: undici/lib/proxy-agent.js)
  • worker_threads (File: undici/lib/websocket/events.js)

I guess my ask is, do you mind providing support for Cloudflare pages with this SDK, and if it's not possible, do you mind pointing me in the right direction in terms of alternatives for someone trying to use SSR capabilities with Appwrite but deploying on Cloudflare.

Thank you for the consideration. 🙂

🎤 Pitch

In my use-case, I really love deploying to Cloudflare because it's very convenient, easy, and free. 🙂

Guessing other people feel the same.

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

shyakadavis avatar Mar 14 '24 13:03 shyakadavis

CF Runtime should be fixed here: ~~https://github.com/appwrite/sdk-generator/pull/795~~ https://github.com/appwrite/sdk-generator/pull/799

docimin avatar Mar 14 '24 14:03 docimin

Thank you.

I'll leave this open as we wait for the P.R to land, but please feel free to close if it's not necessary.

shyakadavis avatar Mar 14 '24 15:03 shyakadavis

Thanks for submitting @shyakadavis.

Assigning this to @loks0n - once https://github.com/appwrite/sdk-generator/pull/799 is merged we should be good to close.

EVDOG4LIFE avatar Mar 20 '24 01:03 EVDOG4LIFE

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

stnguyen90 avatar Apr 24 '24 19:04 stnguyen90

I wanted to try this out in my sveltekit project and get this error when using the rc.4:

image

Looking into the index.mjs file, it seems like every import is without a .mjs extension so that it doesn't get resolved. Adding these file extensions manually fixes the issue. Is this a tsconfig/package.json/vite config error, so that the wrong file gets looked up, or do those .mjs extensions have to be added?

eweren avatar Apr 27 '24 17:04 eweren

Hello, @stnguyen90, @loks0n (sorry for the pings)

Wanted to report the same issue as @eweren. It's currently blocking. 🙃

shyakadavis avatar May 06 '24 10:05 shyakadavis

@eweren, @shyakadavis, let me check with the team.

stnguyen90 avatar May 07 '24 23:05 stnguyen90

Closing since https://github.com/appwrite/sdk-generator/pull/799 is complete.

stnguyen90 avatar May 08 '24 15:05 stnguyen90