Comments (7)
No problem, glad you got it figured out!
There's some known issues around the timing/ordering of context.log
. The host team made some changes recently to address this, but it'll be slow to roll out. The fix may or may not have helped in your case
Azure/azure-functions-nodejs-library#191
Azure/azure-functions-host#9238
from azure-functions-nodejs-worker.
I wanted to add this as a separate comment rather than detract from the original, but I did notice this very odd bit of behavior. If I throw an error immediately after the file download, it looks like the file download completes in a reasonable amount of time:
const fileBuffer = await blobClient.downloadToBuffer(0, undefined, {
blockSize: Math.pow(2, 10) * 256,
onProgress: function ({ loadedBytes }) {
context.log(`progress! ${loadedBytes} of ${contentLength}`);
},
});
throw new Error('blah');
This logs to the console:
[2024-01-19T22:39:25.925Z] progress! 262144 of 1311223
[2024-01-19T22:39:25.936Z] progress! 524288 of 1311223
[2024-01-19T22:39:25.938Z] progress! 524791 of 1311223
[2024-01-19T22:39:25.944Z] progress! 786935 of 1311223
[2024-01-19T22:39:25.952Z] progress! 1049079 of 1311223
[2024-01-19T22:39:25.961Z] progress! 1311223 of 1311223
[2024-01-19T22:39:25.961Z] Error: blah
Note the timestamps --- there is very little delay between retrieving all of the blocks. The whole download completes in ~36ms. Of course, throwing an error does me no good as it fails my function execution. Swallowing the error in a try/catch just reproduces the original behavior
from azure-functions-nodejs-worker.
What version of @azure/storage-blob
are you using? That being said, it's weird to me that it fails when you send an http.get request without even using the @azure/storage-blob
package. That indicates the package theoretically isn't the problem
Could you share the files you're using to test? I'm curious if there's anything weird/unique about them. I used the command mkfile -n 2m 2m
to make a 2mb file (not json though) and your code worked just fine for me locally.
from azure-functions-nodejs-worker.
Hi @ejizba,
We're using @azure/storage-blob ^12.17.0
which I believe is the latest version currently. But like you said, it doesn't appear to be related to that package considering a standard http get
request hangs in the same way.
Here is a sample ~2mb file that I am having trouble downloading
Here is a sample 1.3mb file that I can download, but only after a 3.5 minute hang
from azure-functions-nodejs-worker.
Also confirming I tried mkfile -n 2m 2m
to generate a file, and I am able to download the file successfully without any hanging.
from azure-functions-nodejs-worker.
The sample file worked fine for me 🤷♂️. Maybe it's something unique about your storage account? You could try a fresh new storage account if you think that could be contributing
from azure-functions-nodejs-worker.
@ejizba sorry for bothering you with this. I determined the root cause was in our function app code. After downloading from blob storage, we had a bit of poorly performing code that was taking a long time to operate on the downloaded blob.
It looked like the blob was never finished downloading because I couldn't log the progress to 100%, but it appears that has something to do with using context.log
before a long and resource-intensive process is occurring? If I switched to console.log
I could see that my code was still executing and stuck in a long-running loop. Fixed the long-running loop and the download appears to complete as it should! It also explains why throwing an error after download appeared to finish the download -- the function execution would complete before my long-running loop could start.
from azure-functions-nodejs-worker.
Related Issues (20)
- Time trigger schedule and next scheduled run HOT 5
- No job functions found. Try making your job classes and methods public. HOT 4
- context.debug threw error HOT 2
- Javascript function with service bus trigger delivering byte message HOT 2
- Global `require` overwriting doesn't play nice with applicationinsights 2.5.1+ HOT 4
- Intermittent unknown error, lstat 'D:\home'
- Entry point errors should block app from running
- Increase timeout for `workerInit` and `functionEnvironmentReload` requests
- Create document that describes how to fix Did not find functions with language [node] HOT 1
- System.TimeoutException: The operation has timed out. at Microsoft.Azure.WebJobs.Script.Grpc.GrpcWorkerChannel.PendingItem.OnTimeout()
- Node 18; Func v4; VSCode on macOS: "No job functions found. Try making your job classes and methods public." HOT 3
- Create documentation that describes how to troubleshoot and fix `'0 functions loaded'` HOT 2
- A function can only be registered during app startup. HOT 3
- Support Node 20 HOT 1
- Azure Functions in a monorepo (Node.js) HOT 2
- Test - disregard HOT 1
- Settings on serviceBus.clientRetryOptions is not upheld for serviceBusTopic triggers on the node worker HOT 2
- Azure function and Kudu console NODE version mismatch in linux OS azure function. HOT 8
- Node.js v4 migration - .funcignore additiona of .tsconfig.json HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-functions-nodejs-worker.