
I'm trying to fetch some documents from a collection called transactions
using a cloud function. It works fine when the permission is set to 'Any' in the collection; however, shows an error SyntaxError: Unexpected end of JSON input
when the permission is set to Users
.
I have implemented GoogleOAuth
and executing the function from the client using Client SDK. Why it works when permission is set to Any
and doesn't work when set to Users
even though I'm logged in in the app?
Doesn't the collection authenticate that its documents are being accessed by a registered user through cloud function?
This is the first time I'm trying to implement Cloud Function in Appwrite 🙂
@faye @Steven

You are using next.js, yeah?

Looks like it.
Anyway, did you read this? https://discord.com/channels/564160730845151244/1102936099745177700/1274721373016555540

It's React

Yeah, I read it.. but couldn't understand exactly what to do as I'm not using JWT, rather using GoogleOAuth for authentication.

If the user is logged in in your app, it means the user has a JWT token automatically.
You can get the JWT token by using req.headers["x-appwrite-user-jwt"]
, at least there should be (if the user is logged in), try to log it and see if something pops up.

Sure, thanks

Will reach out if something is intangible for me 🙂

You can also log the entire req
response, it has some other info you might or might not think is useful, like the userId etc.
Recommended threads
- Deleting rows in tables returns 500 on C...
Hey! I'm trying to delete some rows on my dev environment, and I’m receiving 500. I tried to update it and then delete that rows. Updates went well but delete s...
- CORS + 401 Error with Appwrite Authentic...
I'm getting a CORS + 401 Error with Appwrite Authentication Access to fetch at 'https://cloud.appwrite.io/v1/account/sessions/email' from origin 'https://my-c...
- Retreive collection from archived projec...
Hey there, so I archivef a project on 1st September 2025 and now I need the data from one of its collections. Any way I can retrieve it?
