Back

Confusion with Client SDK and Server SDK when in production

  • 0
  • Web
  • Databases
  • Auth
  • General
  • Cloud
Edward Alderson
26 Nov, 2024, 22:37

Hi guys,

this may sound as a stupid question, but I am really at a loss here. I admit I am a novice.

I have a simple CRUD web app built on NextJS, where some actions are performed by the user and some others by the servers. For example, the user registers through a multi field form. On the client side, the user info goes into auth. And the server is supposed to create a document in the collection for the user.

I am surely implementing the logic or understanding something wrong, because in local everything works just fine, but when I deploy to Vercel or Netlify, the server side seems not to respond to the requests. And the whole program just stops.

Taking the example of a form. As the user submits it, I want to use account.create with the email field and the password field (even though I guess this is also possible with the Server SDK). Afterwards I want all the fields to become part of the document in a collection of the db, therefore I use the Server SDK.

How should I set it up?

Thank you a lot

TL;DR
Issue: Developer is experiencing confusion when deploying their NextJS web app to Vercel or Netlify, specifically regarding the communication between Client SDK and Server SDK. Solution: Ensure that the correct SDK (Client or Server) is used for handling actions on the appropriate side. In this case, for user registration in the form, use the Client SDK to handle user info, and then utilize the Server SDK to interact with the database for document creation. Double-check the setup to ensure requests are properly routed to the server-side operations.
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