Azure Function binding issue for BlobInput without any error

I have created in VSCode an azure function in Java that works well locally.

@FunctionName("HttpTriggerGetSha256")
    @StorageAccount("AzureWebJobsStorage")
    public HttpResponseMessage run (
        @HttpTrigger(
            name = "req", 
            methods = {HttpMethod.GET, HttpMethod.POST}, 
            authLevel = AuthorizationLevel.ANONYMOUS) 
        HttpRequestMessage<Optional<String>> request,
        @BlobInput(
            name = "source", 
            dataType = "binary", 
            path = "{Query.directory}/{Query.filename}")  
        byte[] content,
        final ExecutionContext context) {
        context.getLogger().info("Java HTTP trigger processed a request.");
...
}

The input binding is ok, “content” is filled with the content of the filename.

When I deploy to azure, the function fails. The “content” is null which means that there is 2 possible cause:

  • path is not correctly filled and created with the Query
  • it is impossible to open or access the blob I have hardcoded the “path” to make a test but I don’t see any content filled too!

AzureWebJobsStorage is correctly filled.

Any tips or something I have to check?

Answer

After deploying to Azure portal, the value of AzureWebJobsStorage is the connection string of the storage where this Azure function is located.

Here you can check if the value of AzureWebJobsStorage is the connection string of the storage you want to specify.

enter image description here

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *