
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
- Function deployments stuck on waiting
Project ID: **orteos** Function ID: ** crawl_worker** Deployment ID: ** 68a8a8cc668c72293b33** Theres multiple deployments waiting in line
- Urgent: Functions randomly failing with ...
Hi all, I’m facing a critical issue with my Appwrite self-hosted instance where some of my functions have randomly started failing with the following error: `I...
- Synchronous function execution timed out...
Hello everyone! I know this is an old question that many of you have already asked, but I'm doing it again because I can't understand the real solution or impl...
