Skip to content

InvokeBinding doesn't provide an alternative way to work directly with raw data #560

@mtaghavi2005

Description

@mtaghavi2005

Expected Behavior

To be able to get binary data from Azure Blob Storage Binding, working directly with raw data for invoke binding in DaprClient is really needed.

Actual Behavior

There is no way to get raw data by calling InvokeBindingAsync and in case of receiving binary data the JSON Deserialization will raise the following exception:

System.Text.Json.JsonException: '%' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.

Steps to Reproduce the Problem

1- Setup Azure BlobStorage Binding Component
https://docs.dapr.io/operations/components/setup-bindings/supported-bindings/blobstorage/
2- Call InvokeBindingAsync to get a binary blob (E.g. PDF file) from Azure Blob Storage.

   var metadataDictionary = new Dictionary<string, string>()
    {
        { "blobName", "dummy.pdf" },
    };

    var binaryArray = await _daprClient.InvokeBindingAsync<object, byte[]>("blobComponentName", "get", null, metadataDictionary);

Release Note

As suggested in this issue #442 having a Raw method like InvokeMethodRawAsync would solve this issue. I gave it a try, and it could work fine.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions