Hey, i Am facing an error in the database where authorised users are unable to perform any action, it just simply returns the error, the user is not authorised but on the console I can clearly see that the user is authorised. My application has a public profile where when a user signs up, a public profile is created, in the collection it is created but on the app it is returning an error that says server error,
To be precise
server error, code 500 version 0.11.46
Summary
Issue: Users are unable to perform actions in the app due to an "user unauthorized" error, even though the user is authorized in the console. The app creates a public profile in the database collection, but returns a "general_unknown" error.
Solution: The issue may be related to permissions. Check if the related collections can be read by the user or all authenticated users. Make sure to assign roles properly. Clearing the browser cache or deleting existing sessions in the cloud console may also help. Additionally, try creating a dummy collection and test reading from it.
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 11:35
And I have one collection which is open for all to read but still on that screen it is showing user unauthorised
Ernest
Dec 14, 2023, 12:09
Have you tried clearing the apps data and deleting any existing session on cloud console and trying it again. Also are the permissions document-level or collection-level?
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 12:19
Collection level read any and user create, and document level restricted to user itself with user's id
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 12:20
Tried everything
Diversified
Dec 14, 2023, 13:22
Same thing is happening with me, till 3-4 days earlier my code for saving new users was working but doesn't work now gives
Plain text
type: 'general_unknown',
response: {
message: 'Server Error',
code: 500,
type: 'general_unknown',
version: '0.11.46'
}
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 13:36
Even when a collection is read to any it still showing error unauthorised
Ernest
Dec 14, 2023, 13:50
Other devs (web) have encounted the same issue and solved it by clearing the browser cache. It seemed to have been a session cache bug
Diversified
Dec 14, 2023, 13:52
nvm I got what I did wrong, it was the cache thing but to see if its something else I rewrote and messed up my queries, Thanks for repsonses 🙏
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 13:58
But I am facing it on Android, i deleted the complete app and reinstalled it still facing the issue
Ernest
Dec 14, 2023, 14:00
Did you also delete the session via the account's session tab in appwrite console
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 14:00
I'll try that
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 14:09
Showing this message
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 14:13
I assigned everyone to read but only user specific to update delete
Ernest
Dec 14, 2023, 14:23
So is it throwing the error on update or during read?
Ernest
Dec 14, 2023, 14:23
Also could you try creating a dummy collection and try to read from it?
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 15:17
During read
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 15:17
I have a collection which is open for all still it is showing user unauthorised
Ernest
Dec 14, 2023, 15:24
This is a head scratcher for sure 🤔
Drake
Dec 14, 2023, 17:15
what's your project ID?
Also, do you have relationships on this collection?
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 17:16
Yes I do have few relationships with collection
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 17:20
Okay thanks @Steven, I got what I did wrong, Thanks for the response 🌟
Drake
Dec 14, 2023, 17:21
Would you please share so others can learn as well?
Gaurav Solanki
Rank 1: Thread
Dec 14, 2023, 17:27
Okay sure,
So when a user signs up, On the app, the application creates a public profile and writes the data in the collection, but the public profile has relationships with other collections, and there weren't any roles assigned to it.So if anyone is using relationships, make sure related collections can be read by that particular user or all authenticated users(based on your requirement)
Drake
Dec 14, 2023, 17:28
[SOLVED] SDK is creating data in the Database collection but returning the error, general_unknown