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
- Custom Topic sent from Function (with sc...
Can I send a message on a custom topic? So clients can subscribe to them?
- Function scheduling is not functional on...
Hello everyone! I'm using Appwrite Cloud and I have a function that runs every day at 00:00 UTC. Preciously it worked fine, but it didn't fire last night and i...
- fix ip function for whitelisting
Hello, any recommendation how to make IP of Appwrite Function on cloud is fixed for whitelisting purpose?