Azure Functions: Invalid Length for a Base-64 char array or string


Azure Functions: Invalid Length for a Base-64 char array or string


Issue:
·       My function is throwing error - Invalid Length for a Base-64 char array or string
·       My function is using Storage Queue trigger/binding

Solution:

This issue happens when you have storage queue trigger function.
When you send message to storage queue, it expects you to send in base64 encoded string.
Functions expect a base64 encoded string. Any adjustments to the encoding type (in order to prepare data as a base64 encoded string) need to be implemented in the calling service.
This can also be seen on portal when you send message to queue manually.

Invalid Length for a Base-64 char array or string



You should send message in Base64 format.
For example, if you have JavaScript function then you can use btoa module for converting your message to base64 format.


Your function exception will disappear once you send message in base64 format.
I hope this helps.

No comments:

Post a Comment