0

I have a ServiceBusTrigger azure function V4 that is processing all the messages in the queue when I run it locally. But when the application is deployed to Azure, it just sits and does nothing. I'm using ManagedIdentity and all the settings look good. Is there a way to see logs or troubleshoot what might be causing this?

This was working before, but I had to stop a couple of times the Azure Function in Azure to be able to get the message locally and process it in order to troubleshoot somethings. (Without stopping the app, then the instance running in azure was taking the message and was processing it without letting me fetching the message locally). Now it's the opposite. It only runs locally and the instance in Azure does nothing

host.json

{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request"
            }
        }
    }
}

These are the configurations in azure

"APPLICATIONINSIGHTS_CONNECTION_STRING": "InstrumentationKey=9540be89-6878-4d75-831e-dc710d1ebe66;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/",
    "AZURE_CLIENT_ID": "0f6d99bd-a255-4760-aaa2-9a09a65aeef1",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "CarrierServiceFunctionURL": "https://{environmentName}-carrier.azurewebsites.net",
    "CORECLR_ENABLE_PROFILING": "1",
    "CORECLR_PROFILER": "",
    "CORECLR_PROFILER_PATH": "",
    "CustomerServiceFunctionURL": "https://{environmentName}-customer.azurewebsites.net",
    "DD_AGENT_HOST": "",
    "DD_DOTNET_TRACER_HOME": "",
    "DD_INTEGRATIONS": "",
    "DD_LOGS_INJECTION": "",
    "DD_SERVICE": "app-invoice-dev-worker",
    "DOCKER_REGISTRY_SERVER_PASSWORD": "",
    "DOCKER_REGISTRY_SERVER_URL": "integratedtmcr.azurecr.io",
    "DOCKER_REGISTRY_SERVER_USERNAME": "",
    "FUNCTIONS_EXTENSION_VERSION": "~4",
    "KeyVault_Location": "inf-preprod-vault",
    "KeyVaultMongoConnection": "MongoConnection-Invoice-dev",
    "ServiceBusConnection__fullyQualifiedNamespace": "inf-dev-servicebus.servicebus.windows.net",
    "ShipmentServiceFunctionURL": "https://{environmentName}-shipment.azurewebsites.net",
    "WebhookServiceUrl": "https://app-webhook-dev-api.azurewebsites.net/",
    "WEBSITES_ENABLE_APP_SERVICE_STORAGE": false

I have checked connection strings, topic names, that the message exists in the service bus subscription. I have restarted the application.

vadrians
  • 3
  • 5
  • are you running it locally in parallel to the Azure Function? A message in the queue will only be ever processed by one consumer and then its marked as completed. So maybe its just your local consumer taking all the messages?! – silent Apr 27 '23 at 09:23
  • Please check if the connection string parameter, [AzureWebJobsStorage](https://i.imgur.com/UyF79jN.png) in Azure and in configuration Add/Edit application setting add [connectionstring](https://i.imgur.com/GZ0ed7I.png) and [test](https://i.imgur.com/R2iaht3.png) it [once](https://i.imgur.com/LiVn5BY.png) – Sampath Apr 27 '23 at 10:01

1 Answers1

0

ServiceBusTrigger not triggering when in Azure. Runs locally

I Created a sample Service Bus Trigger Locally and deployed into azure which is running.

I have referred this for Service Bus and deployment, and thank`s for your comments @Sampath.

 public void Run([ServiceBusTrigger("naveen", "Naveen", Connection = "Naveen")]string message)
        {
            _logger.LogInformation($"C# Processed message by ServiceBus topic trigger function: {message}");
        }



In local.setting.json
enter image description here

Azure Service Bus Subscription messages :

enter image description here

Local Output :
enter image description here

After Deployment in Azure make sure add all the connection parameters in Azure Function >> Settings >> Application settings and save. I added connection string
enter image description here

Azure Output :

enter image description here

enter image description here

Naveen Sharma
  • 349
  • 2
  • 4