Azure / Azure/azure-functions-host

The 'dataType' setting for the 'blobTrigger' binding in function.json is not respected

Open
#3,995 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

While playing with `blob` and `blobTrigger` bindings with PowerShell, I found the `dataType` setting in the `blobTrigger` binding is completely ignored by the host. The data sent to the worker is always of the `Bytes` type.

At the meantime, For the `blob` input binding, settings `string` and `binary` for `dataType` are respected, but not `stream`. When using `"dataType" : "stream"`, the data sent to the work is an empty `TypedData` (DataCase == None).

/cc @pragnagopa @TylerLeonhardt @anirudhgarg

#### Investigative information

Please provide the following:

- Function App version (1.0 or 2.0): 2.3.199

#### Repro steps

Provide the steps required to reproduce the problem:

1. `dataType` setting is ignored for `blobTrigger` binding.

The `function.json` used for the repro:
```
{
"bindings": [
{
"type": "blobTrigger",
"name": "blob",
"direction": "in",
"dataType": "string",
"path": "samples-input/{name}"
},
{
"type": "blob",
"name": "outBlob",
"direction": "out",
"path": "samples-output/new-{name}"
}
]
}
```

Screenshot of the incoming data in debugger:

![image](https://user-images.githubusercontent.com/127450/51641146-4f351380-1f1a-11e9-8b68-dfcff5fcfff2.png)

2. `"dataType": "stream"` results in an empty `TypedData` object sent by the Host, whose `DataCase = None`.

The `function.json` used for this repro:
```
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "blob",
"name": "inBlob",
"direction": "in",
"dataType": "stream",
"path": "samples-input/text.zip"
},
{
"type": "blob",
"name": "outBlob",
"direction": "out",
"path": "samples-input/string.txt"
}
]
}
```

Screenshot for the incoming data in debugger:

![image](https://user-images.githubusercontent.com/127450/51641628-7c35f600-1f1b-11e9-9d9b-7c607fc17b90.png)

#### Expected behavior

The `dataType` specified in function.json should be respected by the Host and the appropriate data should be sent to the worker.

#### Actual behavior

Actual behavior is shown in the screenshots attached above.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the blobTrigger and blob input cases with the supplied function.json, then trace the host-to-worker binding conversion for dataType and TypedData. Done means string, binary, and stream selections are respected and the worker receives appropriate, non-empty data for the blob input.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.