Azure / Azure/azure-functions-dotnet-worker

Blob Trigger receiving file as string outputs a blank (pdf) document

Open
#1,383 0 comments 1 reaction 0 assignees View on GitHub
needs-investigation
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

I have created a new function app using the Visual Studio wizard selecting version 4 and dotnet framework 4.8

This was discovered after upgrading from framework 4.7.2 to 4.8 and function app v1 to v4 where we were using the Stream parameter which is no longer available for dotnet-isolated apps. I have only tested this with pdf files as this is what my project uses.

Function1 takes a string parameter and writes this to a file - when you open the file it is blank but the file has the appropriate amount of pages
```csharp
[Function("Function1")]
public void Run([BlobTrigger("document-drop/{name}", Connection = "StorageAccountConnectionString")] string myBlob, string name)
{
_logger.LogInformation($"C# Blob trigger function Processed blob\n Name: {name} \n Data: {myBlob}");

File.WriteAllText("C:\\FunctionAppDemoFiles\\TestFileFromString.pdf", myBlob);
}
```

Function2 takes a byte array parameter and writes this to a file - when opening the file it appears with content as expected
```csharp
[Function("Function2")]
public void Run([BlobTrigger("document-drop/{name}", Connection = "StorageAccountConnectionString")] byte[] myBlob, string name)
{
_logger.LogInformation($"C# Blob trigger function Processed blob\n Name: {name} \n Data: {myBlob}");

File.WriteAllBytes("C:\\FunctionAppDemoFiles\\TestFileFromByteArray.pdf", myBlob);
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the two BlobTrigger examples in the issue body and compare the string and byte[] parameter bindings in the dotnet-isolated worker. Reproduce the PDF case, verify the string-written file is blank while the byte-array file retains its content, and identify the binding behavior that needs correction or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.