Azure Queue Trigger to Blob OutputBinding

PS 401 Reputation points
2023-02-28T12:21:59.7966667+00:00

All, I have created a queueTrigger in the Azure portal to pickup queue messages and move it to BLOB storage. and here is the code from function.

using System;  public static void Run(string myQueueItem, out string ContainerLandingOutput, ILogger log) {     log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");      ContainerLandingOutput=myQueueItem; }

and here is my function.json looks like.


{
  "bindings": [
    {
      "name": "myQueueItem",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "outqueue",
      "connection": "AzureWebJobsStorage"
    },
    {
      "name": "ContainerLandingOutput",
      "type": "blob",
      "path": "ContainerName/abc/abc1/abc2/{queueTrigger}",
      "connection": "AzureWebJobsStorage_EDW",
      "direction": "out"
    }
  ],
  "disabled": false
}

Whenever there is a new message in queue, the function triggers but throwing the following error and am not sure what is going wrong.

User's image

can someone pls provide me more insights into where it's going wrong.

Tagging @ShaikMaheer-MSFT , @AnnuKumari-MSFT , @MughundhanRaveendran-MSFT

Thank you!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2023-03-01T10:25:00.0333333+00:00

    @PS Thanks for reaching out. I can see the path as ContainerName/abc/abc1/abc2/{queueTrigger} so it means that whatever the message content is send it will use the same name while creating the blob. So in scenario when the message is simple text then the blob name will be created successfully but let's say you are passing JSON body to your queue message then this json body will be invalid as the blob name and output binding will fail. The suggestion would be change the blob name to randguid or any random name which is valid blob name.

    
    {
      "bindings": [
        {
          "name": "myQueueItem",
          "type": "queueTrigger",
          "direction": "in",
          "queueName": "outqueue",
          "connection": "AzureWebJobsStorage"
        },
        {
          "name": "ContainerLandingOutput",
          "type": "blob",
          "path": "ContainerName/abc/abc1/abc2/{rand-guid}",
          "connection": "AzureWebJobsStorage_EDW",
          "direction": "out"
        }
      ],
      "disabled": false
    }
    
    

    The above will create random blobs and the blob file will have the actual message content.

    Feel free to get back to me if you have any queries or concerns.

    Please accept as "Yes" if the answer is helpful so that it can help others in the community. If you need any help/clarification/concerns/follow up questions, then please click on "Add Comment" on my answer and provide more details.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.