Function disappearing from Azure Function App

Dor Aharony 0 Reputation points
2024-04-26T22:45:17.34+00:00

Hi ,

Im using azure function app triggered by service bus and coding with Python.

when I adding the following line :

from azure.storage.blob import BlobServiceClient

The function disappearing from Azure Function App.

  • I added azure.storage.blob to requirements.txt

The following is my code:

import azure.functions as func
import logging
from azure.storage.blob import BlobServiceClient
import os #in order to get parameters values from azure function app enviroment vartiable - sql password for example 



#function split pdf into pages 
def split_pdf_pages():
    return 1

app = func.FunctionApp()

@app.service_bus_queue_trigger(arg_name="azservicebus", queue_name="ocr",
                               connection="xxxxxxxxxx") 
def servicebus_queue_trigger_ocr_service(azservicebus: func.ServiceBusMessage):
    message_data = azservicebus.get_body().decode('utf-8')
    logging.info('Received messageedf: %s', message_data)
    result = split_pdf_pages()
    logging.info('function result: %s', result)
Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
635 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,106 questions
Azure Startups
Azure Startups
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Startups: Companies that are in their initial stages of business and typically developing a business model and seeking financing.
382 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pinaki Ghatak 4,610 Reputation points Microsoft Employee
    2024-04-29T08:32:09.66+00:00

    Hello @Dor Aharony

    Before you deploy the function ZIP file, that funciton aopp needs to exist. So normally you'd write it like this:

    # Deploy template
          - name: Provision Azure Function App from Bicep
            id: functiondeploy
            uses: azure/arm-deploy@v1
            env:
              DEPLOYMENT_NAME: FunctionDeploy-${{github.run_number}}
            with:
              resourceGroupName: ${{ inputs.targetResourceGroup }}
    
              template: ${{ inputs.buildOutputPath }}/bicep/main.bicep
              parameters: prefix=${{ inputs.Prefix}}
              deploymentMode: Incremental
              deploymentName: ${{env.DEPLOYMENT_NAME}}
    
          - name: Deploy Function App code
            uses: azure/functions-action@v1.4.8
            with:
              app-name: ${{ steps.functiondeploy.outputs.functionName}}
              package: ${{ inputs.buildOutputPath }}/build
    

    in this case, I'd like to see the action the way the app service was deployed, since it seems there are some settings missing. Can you also check, the storage account that is needed for the function app is deployed also?

    0 comments No comments

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.