I have turned the default function to async but still even after using await the code does not wait at
otpData = await database.getDocument(//credentials)
// as the code does not await this, the line below causes an error
// error:: connot read the otp of undefined
otp = otpData.data['otp']
Please do help how am I to tackle such a scenario
I'm sure that getDocument returns the data inside data property.
Try to logout the otpData variable to see what you're getting back.
From what I've seen it should be something like this.
otpData = await database.getDocument(//credentials)
otp = otpData['otp']
Okay alright understood thanks
It worked
thanks a lot
apologies for not getting such a thing right
[SOLVED] Cannot do Asynchronous Programming in a Function
Recommended threads
- No permissions provided for action 'read...
I have a very weird error; In a function I'm using dynamic keys to perform read write operation in rows. I have the scopes for read and write rows. The funct...
- Repository directory size should be less...
Whenever I create a function i get the error above. Is there a way to get around this? How do I fix this?
- "Waiting" executions
For my React Native App, I have had no issues deploying a function in Appwrite & the executions either working or failing. Now I am getting status code - 0 & j...