0

I am trying to create a function that is executed when a file .xlsx is created in a container, and to do that I am using an event grid as proposed by the azure documentation: https://learn.microsoft.com/en-us/azure/azure-functions/functions-event-grid-blob-trigger?pivots=programming-language-python I reproduce each step of this tutorial, and in local enviroment it work, but when I deploy the function and change de EVENT SUBSCRIPTION to the azure endpoint the event subscription is created, but imediatelly after created when I refesh the page it dissapears. In the images (from 1 to 3) the event created to local run, from images 4 to 6 the event created to run in production (azure cloud) where we can see it vanishing. I think that it is because this that the function do no trigger in the cloud.

image_01

image_02

image_03

image_04

image_05

image_06

my code and config:

init.py

import logging
import azure.functions as func

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

function.json

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "myblob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "samples-workitems/{name}",
      "source": "EventGrid",
      "connection": "mvpblobpoc_STORAGE"
    }
  ]
}

host.json

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.3.0, 4.0.0)"
  },
  "concurrency": {
    "dynamicConcurrencyEnabled": true,
    "snapshotPersistenceEnabled": true
  }
}

Can anyone give a tip on how to solve this??

Ikhtesam Afrin
  • 897
  • 1
  • 1
  • 6
Atilio
  • 57
  • 2
  • 10
  • Could you please confirm, your "endpoint cloud" is able to connect to your deployed Function (on azure), endpoint receives a valid and complete response from your deployed Function (on azure). It is not getting blocked by anything – Naveen Sharma Aug 24 '23 at 10:40

1 Answers1

0

I think that it is because that the function do no trigger in the cloud.

Function does trigger as expected, even after deploying on Azure Portal.

I have achieved it in the following way-

I also have created the function in the same way you did and it is working as expected locally.

Local Output:

enter image description here

enter image description here

Then I deployed the function to the function app and added the storage account connection string in App settings like below-

enter image description here

I created the endpoint needed for Even Subscription by taking the blobs_extension key from function app.

enter image description here

My endpoint looks like below

https://<function app name>.azurewebsites.net/runtime/webhooks/blobs?functionName=Host.Functions.<function name>&code=<blobs_extension key>

I am able to see the event after refreshing the page also.

enter image description here

Try to create the event one more time, I believe you will also be able to see it post successful creation.

I have uploaded a file in my blob storage container and it triggered the configured function. In the result of which, I am able to see the below output logs.

enter image description here

enter image description here

Ikhtesam Afrin
  • 897
  • 1
  • 1
  • 6