1

I have recently started reading about Azure Functions so decided to give it a go.

I created a test Azure Function in Visual Code using Python, which should fire off a trigger when a blob has been uploaded to the specified container but for some reason I am getting this error below:

2021-01-14T11:27:32Z   [Error]   Executed 'Functions.TestBlobTrigger' (Failed, Id=dfd0dd15-d937-486d-b6f3-1634745ff14d, Duration=37ms)

To provide more context, this is my function.json file:

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "myblob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "root/test",
      "connection": "AzureWebJobsStorage"
    }
  ]
}

This is my _init_.py file:

import logging

import azure.functions as func


def main(myblob: func.InputStream):
    logging.info(f"Python blob trigger function processed blob \n"
                 f"Name: {myblob.name}\n"
                 f"Blob Size: {myblob.length} bytes")

And finally this is my local.settings.json file:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=XXXX;AccountKey=XXXX;EndpointSuffix=core.windows.net",
    "FUNCTIONS_WORKER_RUNTIME": "python"
  }
}

I'd appreciate any tips in order to guide me in the right direction.

8
  • Have you solved the problem ? Commented Jan 15, 2021 at 3:02
  • nope had no luck as of yet Commented Jan 15, 2021 at 13:13
  • May I know if you already have a function app on azure portal and then deploy the local function to that function app ? Or when you deploy the local function, create the function app on azure portal at the same time ? Commented Jan 18, 2021 at 6:26
  • I already have everything set up, so the function app is already up and running and I have made a test function using a timer trigger and that works fine Commented Jan 18, 2021 at 8:12
  • So you deploy the local function code to a function app which already exists on portal ? Commented Jan 18, 2021 at 8:13

1 Answer 1

1

The problem was caused by the two AzureWebJobsStorage(in local and on portal) are different. When you deploy the function from local to azure, it will not upload the AzureWebJobsStorage in local.settings.json to the application settings of function on portal.

So the solution is copy the value of AzureWebJobsStorage in local.settings.json to replace AzureWebJobsStorage in application settings of function on portal.

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

Comments

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.