Back

Nextjs middleware compatible with node-appwrite sdk?

  • 0
  • Auth
  • Web
Karl
26 Sep, 2024, 17:25

I integrated the node-appwrite sdk into my middleware in next js and during build i got the following warnings. Is the sdk currently supported on the edge-runtime or not? Im on version "node-appwrite": "^13.0.0".

./node_modules/node-appwrite/dist/client.mjs A Node.js API is used (process.version at line: 32) which is not supported in the Edge Runtime. Learn more: https://nextjs.org/docs/api-reference/edge-runtime Import trace for requested module: ./node_modules/node-appwrite/dist/client.mjs ./node_modules/node-appwrite/dist/index.mjs ./src/utils/appwrite.ts ./node_modules/node-appwrite/dist/client.mjs A Node.js API is used (process.version at line: 33) which is not supported in the Edge Runtime. Learn more: https://nextjs.org/docs/api-reference/edge-runtime Import trace for requested module: ./node_modules/node-appwrite/dist/client.mjs ./node_modules/node-appwrite/dist/index.mjs ./src/utils/appwrite.ts

TL;DR
Developers using Next.js and the node-appwrite SDK are unsure if the SDK is supported in the Next.js Edge Runtime due to warnings during the build process about unsupported Node.js APIs. A suggestion was made to update to `"node-appwrite": "^14.1.0"` if using a newer version of Appwrite. Checking the Appwrite version on the webpage was recommended.
Zynth
26 Sep, 2024, 17:28

Why are you using an older node-appwrite? What version is your appwrite instance? Are you using cloud? If so you should update to "node-appwrite": "^14.1.0", since that supports the newer 1.6 appwrite

if you don't know which version of appwrite you are using, check the lower left on the appwrite webpage

Karl
26 Sep, 2024, 17:46

Im using self hosted appwrite version 1.5.11 which is compatible with node-appwrite sdk version 13.0.0

Also my question is not about the appwrite cloud, my question is if the node-appwrite sdk supports running in the middleware in next js because as per their docs the edge runtime doesnt support some Node.js APIs and as you can see in my build process, it even states that.

Zynth
26 Sep, 2024, 17:46

middleware is intercepting server side, so it should work

Karl
26 Sep, 2024, 17:50

I just hosted it on vercel to test it and put in some console.logs, seems to be working but i have my doubts still, should work is not really an answer, because of the unsupported Node.js APIs

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more