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 domain not available
Hello, even tho in docs you clearly describe that every function has its domain, I can not see it anywhere in any of my projects. How do I reveal the url of th...
- Inquiry: How to Reduce Cold Start Durati...
Hey! I was using Python for the function runtime, but after reading that Go has the fastest runtime, I switched my code over to Go. However, I'm still seeing co...
- After a GET request is passed to functio...
Create execution in the console can normally retrieve the get parameters。WHy?