
Heyo,
The web-sdk is client based, I think. Is there an sdk that supports server components?

node-appwrite

If I try to use this, i get: โจฏ ./node_modules/node-appwrite/lib/client.js:1:11 Module not found: Can't resolve 'os'

It seems to be the only way is to use the Rest API? I don't find any info about using it in server components, and installing fs etc. won't work.

honestly, i would advise against using all the server-side related stuff, especially because you're going to run into problems with authentication and sessions.
You may be able to use the web SDK, but you would need to manually manage the session.
Module not found: Can't resolve 'os'
Ya....NextJS has multiple runtimes so the code may not actually be running in a node runtime ๐

Hey, I understand with authentication etc. But what about getting documents? Or would you rather use api routes for this?

I would try to avoid connecting to Appwrite server-side. I would only fetch the documents client-side.

I do have one more question, is there a proper example on how to use authentication and get a cookie instead of local storage?

Every time i login, I get it as local storage, however sometimes it seems to make a cookie, but rarely.

(using the example btw)

The cookie is should always be set (when the session is created client side). Maybe if you weren't using HTTPS or if there's some other SSL issue between the client and Appwrite.

Alright, thanks.

[SOLVED] Can I use appwrite sdk using nextjs server components?
Recommended threads
- React native app login via Safari
Hi! I deployed for debug my React Native app in web, chrome everythink works well but in safari on mac and ios I cant login. I found this one error in safari co...
- Relationships restricted to a max depth ...
When I do query like: ``` await _databases.listDocuments( databaseId: AppwriteConfig.DATABASE_ID, collectionId: AppwriteConfig.SERVICES_COLLECTI...
- Invalid credentials after migration
Hi everyone! After migrating our self-hosted Appwrite 1.3.1 to another server (staging, so a different domain), we are now getting 'Invalid credentials' when ...
