Back
AppwriteException: Invalid `userId` param: UID must contain at most 36 chars. Valid chars are a-z...
- 0
- Functions
- Cloud

Trying to use the users.listSessions as given here https://appwrite.io/docs/references/cloud/server-nodejs/users#listSessions here's my code
TypeScript
const result = await users.listSessions({
userId: userslist.users[0].$id
});```
I wonder why im getting this error, my userId doesnt exceed 36 chars, nor does it have underscore in the beginning , heres whats logged in ```userslist.users[0].$id```
```685add06748f633325b0```
Full Error:
```Error in purge-user-sessions function: AppwriteException: Invalid `userId` param: UID must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, and underscore. Can't start with a leading underscore
at _Client.call (file:///usr/local/server/src/function/node_modules/node-appwrite/dist/client.mjs:293:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Module.default (file:///usr/local/server/src/function/src/index.js:38:20)
at async execute (/usr/local/server/src/server.js:220:16)
at async action (/usr/local/server/src/server.js:237:7)
at async /usr/local/server/src/server.js:26:5```
Edit: Add full error in the post message
TL;DR
AppwriteException is being thrown due to the `userId` param exceeding 36 chars, even though the length seems valid. The issue might be related to characters other than alphanumerics or incorrect leading underscore. Check code and potential data issues.
AppwriteException: Invalid userId
param: UID must contain at most 36 chars. Valid chars are a-z...
Recommended threads
- Custom Domain - Verification failed
Hello this may be a silly question but I am having issues trying to add my custom domain to my project when I add my domain and click verify it says my domain w...
- Is the Java SDK still a thing?
Hey, maybe its time to go back to Spring Boot. Regarding this I have the question if the Java SDK is updated and working?
- Realtime when app is in background mode
I am wondering if realtime can work if the app is in the background. For instance if uber drivers can go to a different app to answer a message but still receiv...
