Share via

Blob trigger stream too long - Typescript

Ivan Bodrozic 0 Reputation points
2024-07-22T08:50:36.4833333+00:00

When attempting to trigger a Blob Trigger Function App with a ~2 GB file, I receive a Stream too long error.
As I understand it, the Function App loads the entire file into memory, which likely causes this issue.
Is there any known workaround for this problem?

Thanks!

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 41,641 Reputation points MVP Volunteer Moderator
    2026-05-18T19:02:52.09+00:00

    Hello Ivan !

    Thank you for posting on Microsoft Learn Q&A.

    This is expected behavior for very large blobs because blob trigger provides the blob content as input to the function and the TypeScript example uses a Buffer so a 2 GB file can hit memory limits before your function logic really starts. Loading full blob content into memory is only suitable for small blobs.

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-trigger

    The usual workaround is not to process the large file directly through the Blob Trigger binding. Instead, you can use Event Grid to notify the function that a blob was created then use the Azure Storage SDK to read the blob yourself as a stream.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.