Back

I'm facing a lot issues with next js while using it with appwrite

  • 0
  • Accounts
  • Web
Berserker
28 Mar, 2023, 16:30

requests are being sent but the users are not getting created , maybe i think my code could be possibly wrong

TL;DR
User is facing issues with using Next.js with Appwrite. They are confused about creating a database from the client side and are also unsure about using server-side rendering (SSR) with Appwrite. The user is also experiencing an error related to the use of `await` in their code. Another user suggests using the react-appwrite package and provides a link to it. Finally, the user expresses concerns about the users not getting created and wonders if their code is incorrect. Solution: 1. The user can try using the react-appwrite package as a workaround for the issues they are facing. 2. It is recommended to avoid
Berserker
28 Mar, 2023, 16:30

i followed this just coz' it was sponsored by appwrite

Berserker
28 Mar, 2023, 16:30

should I use things like axios ??

Berserker
28 Mar, 2023, 16:31

and I was** unable to find a guide for using next js with appwrite**

safwan
28 Mar, 2023, 17:58

hey @Berserker

safwan
28 Mar, 2023, 17:58
Berserker
28 Mar, 2023, 17:58

lemme check

Berserker
28 Mar, 2023, 17:59

thnx bro

Berserker
28 Mar, 2023, 18:08

@joeyouss is there any work around ?

Berserker
29 Mar, 2023, 08:18

@safwan bro how to use this package , i meant what this package will do ?

Drake
29 Mar, 2023, 17:41

First off, I highly recommend avoiding server-side rending if possible. server-side rendering it makes your app significantly more complicated because you have to manage sessions on the client AND on the server.

Back to your error, though....what's your code in ./src/app/components/appwrite[server].js? The error says you're using await somewhere that isn't allowed.

Berserker
29 Mar, 2023, 18:04

@Steven may I know y SSR is bad

Berserker
29 Mar, 2023, 18:04

Okie

Drake
29 Mar, 2023, 18:06

server-side rendering it makes your app significantly more complicated because you have some code running client side and some code running server side. if you have a session with some external API on the client side, your server-side code won't automatically have it. you need to manage that yourself.

Berserker
29 Mar, 2023, 18:07

Okie got it sir , i thought SSR would make things fast and thank u

Berserker
29 Mar, 2023, 18:08

@safwan here is the file

Berserker
29 Mar, 2023, 18:10
Drake
29 Mar, 2023, 18:11

i think there are 2 benefits to SSR:

  1. SEO since crawlers can easily index the data
  2. maybe faster if you have a ton of logic and the server is a lot more powerful than the client since the client doesn't need to process the javascript, but the server will have to

However, it makes the app significantly more complicated for the reasons I mentioned.

Berserker
29 Mar, 2023, 18:11

okie sir as a beginner , then I have to go with client side i think so

Drake
29 Mar, 2023, 18:11

so you have an await there that's not in a function. that's not allowed

Berserker
29 Mar, 2023, 18:12

okie lemme fix it

Berserker
29 Mar, 2023, 18:15

@Steven then can i do the stuffs like creating database **from the client side itself **; using sdk

Drake
29 Mar, 2023, 18:33

No, I typically do that with an Appwrite Function. You can try to do that with a NextJS server side endpoint, but you may need to manage access to your endpoint yourself

Berserker
29 Mar, 2023, 18:42

@Steven Then I'll go with appwrite function itself , i don't wanna put myself into trouble

Berserker
29 Mar, 2023, 18:42

@Steven again thnk u sir

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