Azure / Azure/azure-functions-host
When mixing Imperative bindings for blob and Declarative bindings for Queue messages, queue messages are written first even when Blob messages are explicitly flushed
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
I am using a binder to construct the blob name at runtime in my Azure Function. Additionally, I have a queue binding that is declarative. I write to the blob and then flush and close the text writer. Then I add the queue message to the collection. However, the queue message is written before the blob, resulting in the next function in the chain seeing an error.
#### Investigative information
- Timestamp: 2017-09-30T00:21:00Z
- Invocation ID:
bc72ea3d-0170-4e30-9a4e-6c78504b8498 (parent job, which publishes blob & queue).
4b77107d-4a80-433a-8bf4-d50c2788b84f (sample queue message job)
- Region: NCUS
#### Repro steps
1. Create an Azure Function
2. Set an Azure Queue as the output.
3. Have the function output a blob using a binder.
4. Write to the blob, and then the queue. Example:
` using (var writer = await binder.BindAsync(attributes))
{
writer.Write(output);
writer.Flush();
writer.Close();
}
await outputQueueItem.AddAsync(new SomePoco {Name = blobName});
`
5. Create an Azure Function which takes a QueueMessage with SomePoco as a trigger, and takes a blob with the Name of SomePoco as input.
#### Expected behavior
I expect the write to the blob to be blocking, and for the queue message to be written after the blob has been written.
#### Actual behavior
The blob messages are not written until the parent function completely finishes execution. While the queue messages are written while the parent function is still running.
#### Known workarounds
Have a copy of the function which processes the SomePoco queue messages, except it accepts input from the poison queue message stream. Then use this to manually clear out poison queue messages.
#### Related information
Provide any related information
* Programming language used: C#
Contributor guide
Research direction
Start by running the five-step reproduction with an Azure Function using a binder for the blob and a declarative queue output. Trace when each output is persisted relative to function completion; done means the blob is written before the queued message is published, so the downstream function can read it successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100