Aarush AcharyaOriginal post
Rank 3: Container
I have turned the default function to async but still even after using await the code does not wait at
JavaScript
otpData = await database.getDocument(//credentials) // as the code does not await this, the line below causes an error// error:: connot read the otp of undefinedotp = otpData.data['otp']Please do help how am I to tackle such a scenario
Summary
The user encountered an error when trying to perform asynchronous programming in a function. They mentioned that the problem is solved, but did not provide any specific solution. Another user suggested that the issue might be due to a `getDocument` function that returns data inside a `data` property. They recommended logging the `otpData` variable to verify the data structure. The user then shared an example code snippet showing how to await the `getDocument` function and access the `otp` value. The user is seeking further help on how to handle this scenario.
Solution: It is recommended to ensure that the `getDocument` function is returning the