If an blob binding has the in or inout direction and that blob does not exist, the function will not run.
This makes it impossible to check whether a blob exists or use input direction for any blob that may not exist.
Please provide the following:
Using in direction:
2017-07-06T20:04:50.157 Function started (Id=9cc99405-8ee7-4b98-b7c6-bbdeb8afc82b)
2017-07-06T20:04:50.173 Function completed (Failure, Id=9cc99405-8ee7-4b98-b7c6-bbdeb8afc82b, Duration=10ms)
2017-07-06T20:04:50.338 Exception while executing function: Functions.lookup-lsc-01-http. mscorlib: Value cannot be null.
Parameter name: stream.
Using inout direction:
2017-07-06T19:51:11.227 Function started (Id=c06d64d0-0c75-4ea8-96f5-3151852d5dff)
2017-07-06T19:51:11.227 Function completed (Failure, Id=c06d64d0-0c75-4ea8-96f5-3151852d5dff, Duration=1ms)
2017-07-06T19:51:11.274 Exception while executing function: Functions.lookup-lsc-01-http. Microsoft.Azure.WebJobs.Host: Cannot bind blob to Stream using FileAccess ReadWrite.
Provide the steps required to reproduce the problem:
Provide a description of the expected behavior.
context.log('START'); is the first line at the top of the function bodyProvide a description of the actual behavior observed.
Provide a description of any known workarounds.
Not using binding functionality for any input blob that may not exist, but instead using the Azure Storage SDK to access the blob manually.
Provide any related information
Example function.json:
{
"bindings": [
{
"name": "req",
"type": "httpTrigger",
"direction": "in",
"authLevel": "anonymous",
"route": "api/http-input-blob/{container}/{*blob}"
},
{
"name": "res",
"type": "http",
"direction": "out"
},
{
"name": "inInputBlob",
"type": "blob",
"direction": "in",
"path": "{container}/{blob}",
"connection": "AZURE_STORAGE_CONNECTION_STRING"
}
],
"disabled": false
}
Example Source at: https://github.com/toldsoftware/told-stack/blob/master/told-stack-npm/src/data-patterns/http-input-blob/src-server/function-01-http.ts
This behavior is by design. If the resource may not exist at execution time then avoid using an input binding.
Why not set it to null as occurs for Table Storage when a matching entity of a given key is not found?
There are many use cases that cannot be done without this:
So by design the input blob is only useful for fixed blob routes (and using http routing to point to a blob with a dynamic blob name is essentially useless because there is no way to handle the not found case in user land).
Agreed - this is breaking a use case I had for an azure function which first checked whether a blob exists.
@paulbatum
Where can we go to request this design be changed?
It is a serious limitation that prevents most use cases for blob binding.
Understood. I opened https://github.com/Azure/azure-webjobs-sdk/issues/1326 to track. Please comment on this issue further with more specifics on how you would like to see this work.
Most helpful comment
Why not set it to null as occurs for Table Storage when a matching entity of a given key is not found?
There are many use cases that cannot be done without this:
So by design the input blob is only useful for fixed blob routes (and using http routing to point to a blob with a dynamic blob name is essentially useless because there is no way to handle the not found case in user land).