Azure Function Not Triggering by Event Hub in Consumption plan
Hi Folks
- I have a Event Hub Trigger function app with consumption plan. It was working, when I open the portal in UI & continue to run for 3-4 hours , after that it automatically sleeps, when no request coming to event hub.
- Next day when request come again , it is not triggering, until I open portal. I am facing the same issue for last 2 weeks
- In last, I have to swap @from Consumption Plan to App Service Plan to run this.
When we can expect fix for Consumption Plan ???? @cgillum & @davidebbo Thanks.
@navilwayne Does your connection string have an EntityPath? If so can you try removing it? We have a bug in our scale infrastructure that prevents us from reading the state of the event hub if there is an entity path present.
Hi @paulbatum Yes, I have EntityPath in my connection string(EntityPath contains name of Event Hub) Sample Endpoint=sb://xxxxxxxxx.servicebus.windows.net/;SharedAccessKeyName=xxxxxxx;SharedAccessKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=;EntityPath=xxxxxxxxxxxx
I am getting below error if I removed entity path from connection string as suggested by you. Microsoft.ServiceBus: The messaging entity 'Management operation failed. status-code: 404, status-description: The messaging entity 'sb://xxxxxxxxxxx.servicebus.windows.net/samples-workitems' could not be found..' could not be found.
Session Id: c1c36cf02ce54fd89d26704d9cb57f22
Please suggest. Thanks.
@navilwayne Did you enter the correct name of your event hub in the integrate section of the UI?

Alternatively if you are working from within VS or using the "advanced editor" the input binding in your function.json should have the correct "path" property that corresponds to your event hub name:
{
"type": "eventHubTrigger",
"name": "sensorEvent",
"direction": "in",
"connection": "EventHubsConnectionString",
"path": "hub1",
"consumerGroup": "$Default"
},
@paulbatum Yes It is working now. But is this finalised now that always we have to remove the entity path from connection string in event hub scenario or it is temporary fix.
In what another scenario's we have to do modification in connection string. For example in Blob or etc.
@navilwayne glad to hear its working. Removing the entity path from the connection string is a temporary workaround until we fix a bug on our side. You shouldn't need to do this any other scenarios (that I'm aware of).
I have the same problem - as soon as I close portal blade for function app, it stops receiving events. My connection string does not contain EntityPath. I have two Azure Functions in two different resource groups. One works and the other does not. Frustrating.
@sergsalo Can you share your function app name (that's the app name, not function name!), either directly or indirectly? This will help us investigate. Thanks!
@davidebbo let me recreate it, because I started to use app service plan instead of consumption plan.
Thanks. If it's a test site, then you may as well share the App Name directly, which is a bit easier.
it seems like it is working after redeployment. I will leave it overnight, and report back if it stops working.
Odd. Oh well, if you or anyone else run into this again, please give us the Function app name and we'll dig into it from our end. But as far as we know, the issue is now fixed.
Hi @davidebbo, I've got similar problem, but on App Service Plan (Standard S1). We've got function with Event Hub trigger, Always On is turned on in Application Settings. Everything worked fine for a couple of days, and then it stopped processing any event hub messages. After opening Function editor in portal and manually triggering the Function using Run button, it processed events and started working, but after a few hours it stopped again. The function app name is cx-in-functions.
@xelossan the issue discussed here was very specific the the Consumption plan (I just clarified the title). Closing this one since we believe it is fully fixed.
Please open a separate one if you see thing in a Standard plan. Make sure to include the details we need for investigation, as discussed above (site name, function name, timeframe of incident, ...).
@davidebbo It happens again. Consumption plan. Function name: ampbrokerhxc23nhsty2jk, appName: http://ampbrokerhxc23nhsty2jk.azurewebsites.net.
The interval between data arrival is 5 minutes. Trigger: TriggerAzureMetrics. If I watch it - it works fine. If I leave portal - it stops working. consistent.
@sergsalo I have a suspicion as to what might be going on: how are you editing your function files, and in particular function.json (which contains the triggers)? If you're doing it via App Service Editor, then it doesn't properly sync the triggers, which would explain this.
Try going to the Functions UI and clicking the Refresh button in the bottom left corner. That should get you fixed up.
@davidebbo apparently it is working now after refresh. We deploy function using ARM Template and powershell scripts to push code. Is there API we can call to "refresh" after deploy?
We are pushing using Kudu API: $apiUrl = "https://" + $functionName + ".scm.azurewebsites.net/api/zip/site/wwwroot" Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method PUT -InFile $fileName -ContentType "multipart/form-data".
Ah yes, that would do it. Currently, the only deployment techniques that automatically do a sync are:
- Function Portal
- Git deployment via Kudu
- WebDeploy (e.g. VS publishing or VSTS)
I think if you integrate the PowerShell I gave you into your script, it will work reliably.
cool, thank you so much for quick update!