I am using ID.unique() as I expected it will generate unique ID
Yet this is the declaration of it
Maybe that is the problem
Ok no that is not the issue, I still get anonymous users created
From console logs
"{\"email\": \"user@example.com\",\"password\": \"example\",\"name\": \"User example\"}"
PAYLOAD PARSED
{"email": "user@example.com","password": "example","name": "User example"}
USER_ID
6j4o3p1vi8eqtg6hrxag```
From function response
```{"response":{"statusCode":200,"body":{"$id":"6j4o3p1vi8eqtg6hrxag","$createdAt":"2023-07-21T12:33:01.097+00:00","$updatedAt":"2023-07-21T12:33:01.097+00:00","name":"","password":"","hash":"argon2","hashOptions":{"memoryCost":2048,"timeCost":4,"threads":3},"registration":"2023-07-21T12:33:01.096+00:00","status":true,"passwordUpdate":"","email":"","phone":"","emailVerification":false,"phoneVerification":false,"prefs":[]}},"payload":"\"{\\\"email\\\": \\\"user@example.com\\\",\\\"password\\\": \\\"example\\\",\\\"name\\\": \\\"User example\\\"}\""}```
Idk why this is happening
I still can't figure out why is it creating anonymous user :x
These are my console log results
PAYLOAD UNPARSED
"{email: \"user@example.com\",\"password\": \"example\",\"name\": \"User example\"}"
PAYLOAD PARSED
{email: "user@example.com","password": "example","name": "User example"}
USER_ID
msm2ajmpvwn3nh7afdj0
USER_EMAIL
USER_PASSWORD
USER_NAME
These are my console logs
const payload: IUser = JSON.parse(req.payload);
console.log('PAYLOAD PARSED')
console.log(payload)
const userId = ID.custom(generateUniqueId());
console.log('USER_ID')
console.log(userId)
console.log('USER_EMAIL')
console.log(payload.email)
console.log('USER_PASSWORD')
console.log(payload.password)
console.log('USER_NAME')
console.log(payload.name)
So for some reason payload variables aren't fetched
in here, don't escape/wrap with quotes. it should be:
{"email": "user@example.com","password": "example","name": "User example"}
This is parsed payload. While I am sending stringified and then parsing it - which is supposedly okay based on the console logs?
And I console.log parsed one, the one you wrote, and it doesn't return property values
no you shouldn't be escaping stuff when putting it in the console
ok, so as I am going to be sending stringified payload from the client, then I can't test stringified payload via console π¦
no, it's because in the console it's already a string...you're so you're stringifying it again by putting:
"{\"email\": \"user@example.com\",\"password\": \"example\",\"name\": \"User example\"}"
I see now, that was really confusing, didn't know it was a string already as I didn't see any note about it. Thanks for helping out, it works fine now
a note...like the example below?
Maybe this? Not sure if it would be helpful to have this note in the console as well. I missed it :X
did you look right under the input box for the custom data in the console?
Yes. But that also didn't indicate I can't really put stringified payload in there π And as I missed the docs I sent, took a while to figure out.
Another thing that might be good is interlinking appwrite console with the documentation. But that would be to the UI people to decide, I can't really tell where would be good places to do that
if you put a stringified payload, your code would need to parse it twice
Like placing links to docs, or making hover effect labels that would give more information about something in the console
Yeah π Either way, it works now and I can continue working on my app π
[SOLVED] Appwrite function - anonymous user created even with payload present
Recommended threads
- HTTP POST to function returning "No Appw...
Hi everyone, Iβm running into an issue with my self-hosted Appwrite instance. Iβve set up my environment variables (APPWRITE_FUNCTION_PROJECT_ID, APPWRITE_FUNC...
- Can't add dart 3.5 runtime
Modified the `.env` to enable dart 3.5 runtime on my self-hosted instance but still can't find the runtime when creating a new function. I manually pulled the i...
- How to verify an user using AppWrite Fun...
I have seen similar questions but none whose solutions serve me. I have a function to verify a user with their secret and their id: https://blahblah.appwrite.gl...