#[SOLVED] ID.unique() doesn't work
59 messages · Page 1 of 1 (latest)
What's the problem? I don't think I understood
So this was the error that I first encountered
query used
I thought somethign would be wrong with the ID gen but then I also triied using uuid package which is giving a similar error
Can you replace Id.unique() function with a simple string 'unique()'
Can you open the network tab and show me the request body
none, but there are relatiosn in attributes
But you're using your own random ID generator? Or using appwrite's ID.unique?
Do you have indexes on any collection?
yes on a users table which has relation to boards which has relation to sounds
Is that a unique index?
appwrite IDs I am taking as props are for urls
should be, they are emails
does it cause problems?
Not sure yet... Can you share all the indexes you have..
also here should the doucmentId have "unique()"
Yea you can give it a shot to quickly rule it out
still gives the error
Where do you find this? What's your SDK version?
And do you have imported ID from Appwrite?
yes I have imported ID from Appwrite
also using the same qeury I have boards being created that works as expected
Fo reference to this error,
The only chnages I made to attributes is firstly relations between the tables, then the indexing of email and lastly changed sounds to be deleted ie cascade when board is dleted
The name, creator, logo, etc part doesn't looks correct
Nevermind, the variable is correct
Oh, wait, what's it. Could you please send it?
Or an example?
name contains just name?
It should be like a JSON. Something like this:
{
"name": "D5"
}
name is a string and is getting parsed correctly, my issue lies with a specific collection which throws error mentioned before
Something I tried is I created a new user and this allowed me to upload/save a document(sound) but the secodn time its throws an error
is the ID caching in the backend or someting
In the log doesn't looks correct
Looks like this:
{
name: "D5"
}
Not sure if it's due to browser interpretation or similar 😅
Are you using Appwrite cloud or self-hosting?
should be that cause in DB it is correct
cloud
It's not in DB but in your variable
What's the part of the code where you set the variable?
what variable?
This issue got my head scratching, but finally I realised what was wrong, the error message was right but it should've been more verbose
My Sounds collection has one to one relation with user, this caused the error to occur, idk how this didn't happen before when I was testing . Anyways thanks.
Hwo can I close this thread
I'm closing it. Makes sense, didn't have thought about the relationship 😅
[SOLVED] ID.unique() doesn't work
Thanks for the feedback. I will relay this to the team. We can try and have a better error message in this case 👍
Do you mind sharing the structures of the collections in question? The songs and users collection and how they are related?
Thanks