I am using Nodejs to download a file to a buffer to use for processing in my code. The relevant code is
let bbc = containerClient.getBlockBlobClient(
userId + "/" + documentUuids[i] + ".pdf"
);
let blob;
try {
console.log("downloading blob")
blob = await bbc.downloadToBuffer();
console.log("downloaded blob ")
} catch (e) {
console.log(userId + "/" + documentUuids[i] + ".pdf")
console.log(e);
}
However, instead of waiting for the download and then proceeding with the rest of the code, the line blob = await bbc.downloadToBuffer();
prematurely ends the function app and returns a 200 with no body. In the console I then see the message
Warning: Unexpected call to 'log' on the context object after function execution has completed. Please check for asynchronous calls that are not awaited or calls to 'done' made before function execution completes. Function name: BasketsCreateUpdate. Invocation Id: 59f57785-6390-4b93-a69e-8244dc688d37. Learn more: https://go.microsoft.com/fwlink/?linkid=2097909
and eventually in my logs, I see the required output, but the function has already prematurely returned an empty body. I have no idea why this is happening, and I would appreciate any help.