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
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- Custom Domains
Hi All, Should be a quick config issue. I'm setting up custom domains on the hosted version. I have verified the domain with the CNAME but appwrite isn't gene...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...