1

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?

0

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, indeed, I've just check and change the code to @StorageAccount("Storage_Account_Connection_String"), add it to the app configuration but I still have the same problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.