Azure WebJob QueueTrigger Throwing StorageException 404 Not Found - azure

I am working with Azure Queues, Controlling them using WebJob, In the functions file i have one QueueTrigger function, which fires up when AzureQueue receives some message.
Now the problem is that function (QueueTrigger) executes successfully, I have setup proper exception handling inside queue trigger function, everything executed without any errors. But when QueueTrigger function ends, code is throwing exception. Storage Exception 404 Not found.
and that message is not getting deleted from queue. Next time when i run job it is still fetching the old message. I have manually created storage containers
azure-jobs-host-archive
azure-jobs-host-output
azure-webjobs-dashboard
azure-webjobs-hosts
I have seen in one post answer but this does not help at all.
I have no idea how to tackle this exception or why this exception in throwing in the code.
Thank you
Eman

After updating the following packages the problem get solved.
Microsoft.WindowAzure.Storage
Microsoft.Azure.Webjobs
Microsoft.Azure.WebJobs.Host

Related

Orchestrator function 'XYZ' failed: The function 'XYZ' doesn't exist, is disabled, or is not an orchestrator function

I'm trying to run Azure Orchestrations and I sunddenly I started getting the error from the statusQueryGetUri:
Orchestrator function 'UploadDocumentOrchestrator' failed: The function 'UploadDocumentOrchestrator' doesn't exist, is disabled, or is not an orchestrator function.
I've run this functions dozens of times today without any issue. VSCode doesn't flag any issues. I've tried restarting and that hasn't helped either.
This has happened once before. I got the error, troubleshot for like 3 hours, got frustrated, left, and came back to my computer an hour later and the problem was resolved without changing anything. I suspect the issue is related to caching somehow, but I'm not sure where to fix this.
There is a similar issue noted at:
https://github.com/Azure/azure-functions-durable-extension/issues/577
After I run func start, my "missing" orchestration appears in the launch screen indicating that it is valid as shown below.
I start the UploadDocumentOrchestrator with the HttpTrigger StartUploadDocuments. I see the trigger complete its execution UploadDocumentOrchestrator never starts in the logs.
UploadDocumentOrchestrator: orchestrationTrigger
For detailed output, run func with --verbose flag.
[2023-01-11T19:58:10.490Z] Executing 'StartUploadDocuments' (Reason='This function was programmatically called via the host APIs.', Id=f158ac3e-fa39-403c-9671-307ea54d5948)
[2023-01-11T19:58:10.599Z] Started orchestration with ID = '29b9ab7fcffe4f59bd47032ef21c19e8'.
[2023-01-11T19:58:10.620Z] Executed 'StartUploadDocuments' (Succeeded, Id=f158ac3e-fa39-403c-9671-307ea54d5948, Duration=154ms)
[2023-01-11T19:58:13.952Z] Host lock lease acquired by instance ID '0000000000000000000000004906C298'.
As it mentioned in the Same GitHub Ticket, it is solved by clearing the Azure storage emulator data, check here.
It might be due to the Caching issue and also #ConnorMcMahon given another scenario in GitHub Issue #1381 of the same error - renaming the function caused the same issue for a few users:
The function ‘XYZ’ doesn’t exist, is disabled, or is not an orchestrator function.

Stopping the listener 'Microsoft.Azure.WebJobs.Host.Blobs.Listeners.BlobListener' for function <XXX>

I have function app where I have one HttpTrigger and 3 BlobTrigger functions. After I deployed it, http trigger is working fine but for others functions which are blob triggers, it gives following errors
"Stopping the listener 'Microsoft.Azure.WebJobs.Host.Blobs.Listeners.BlobListener' for function " for one function
Stopping the listener 'Microsoft.Azure.WebJobs.Host.Listeners.CompositeListener' for function
" for another two
I verified with other environments and config values are same/similar so not sure why we are getting this issue in one environment only. I am using consumption mode.
Update: When file is placed in a blob function is not getting triggered.
Stopping the listener 'Microsoft.Azure.WebJobs.Host.Blobs.Listeners.BlobListener' for function
I was observed the same message when working on the Azure Functions Queue Trigger:
This message doesn't mean the error in function. Due to timeout of Function activity, this message will appear in the App Insights > Traces.
I have stopped sending the messages in the Queue for some time and has been observed the traces like Web Job Host Stopped and if you run the function again or any continuous activity is present in the Function, then this message will not appear in the traces.
If you are using elastic Premium and has VNET integrated, the non-http trigers needs Runtime scale monitoring enabled.
You can find Function App-->Configuration--> Function runtime settings and turn on Runtime scale monitoring.
If function app and storage account which holds the metadata of the function Private linked, you will need to add the app settings WEBSITE_CONTENTOVERVNET = 1.
Also, make sure you have private linked for blob, file, table and queue on storage account.
I created ticket with MS to fix this issue. After analysis I did some code changes as
Function was async but returning void so changed to return Task.
For the trigger I was using connection string from app settings. But then I changed it to azureWebJobStorage(even though bobth were same) in function trigger attribute param
It started working. So posting here in case it is helpful for others

Azure Function Timer Trigger & API management - Manual execution returns 404

I have a function app with:
a few functions triggered by a Timer Trigger
and some triggered by the HTTP Trigger.
I have also an Azure API Management service set up for the function app, where the HTTP Triggered functions have their endpoints defined.
I am trying to trigger one of my timer triggered functions manually as per the guide here https://learn.microsoft.com/en-us/azure/azure-functions/functions-manually-run-non-http
I am however getting a 404 result in Postman, despite the seemingly correct URL and x-functions-key.
The function:
The key:
The request:
I also noticed that:
if I don't include the x-functions-key header, then I get 401 Unauthorized result
and if I include an incorrect key, then I get 403 Forbidden.
Could it be related to the API management service being set up for the function app?
How can I troubleshoot this further?
I have managed to solve it.
It turns out that Azure Functions timer trigger requires six parts cron expression (I was only aware of the five part style)
Without that, it does not work - sadly this is not easily noticeable in the UI.
I have realized that by investigating Application Insights logs:
The function page shows that everything is fine:
Changing the CRON format has fixed the 404 issue and I started getting 202 Accepted response.
As a bonus note, I have to add:
Even though the response was 202 Accepted, the triggering didn't work correctly, because my function return type was Task<IActionResult> which is not accepted for timer triggered functions.
Again, only ApplicationInsights showed that anything is wrong:
The 'MonkeyUserRandom' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'MonkeyUserRandom'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter '$return' to type IActionResult&. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
That's a bonus tip for a 'manual triggering of non-http function does not work'.
I test it in my side, it works fine. Please refer to the below screenshot:
Please check if you request https://xxx.azurewebsites.net/admin/functions/TimerTrigger1 but not https://xxx.azurewebsites.net/admin/functions/TimerTrigger. Note it's "TimerTrigger1".
I requst with ..../TimerTrigger at first test because the document shows us QueueTrigger, and it response 404.

Azure durable function log stream showing deleted function

I have deployed a change to a durable function product into Azure DevOps and part of the work was to rename an activity function.
However the warning below is appearing in the log stream containing the old name for the function.
[Warning] Activity function 'PublishNotification' does not exist..
InstanceId: . Function: PublishNotification.
This function publishes a message to a Service bus topic, and there is definitely now no reference to that function name anywhere in the code.
Any ideas where this might be coming from?
From your description, it seems that your function name has been changed, the orchestrator function listener and other function listeners are been deregistered:
https://github.com/Azure/azure-functions-durable-extension/blob/f6f1dce716b68d8baaa99ed64a9db1306577c58d/src/WebJobs.Extensions.DurableTask/Listener/DurableTaskListener.cs#L44-L54
But the orchestrator function is still running, and it cannot find your previous function name:
https://github.com/Azure/azure-functions-durable-extension/blob/f6f1dce716b68d8baaa99ed64a9db1306577c58d/src/WebJobs.Extensions.DurableTask/DurableOrchestrationContext.cs#L385
If you restart the function app and let everything start again, can you still reproduce this error?
I went into the Azure web job storage queues and had a look around. Turns our there was an old message (about 4 days old) stuck in one of the queues and when that was cleared out the warning messages disappeared too.

Azure function-Timer unscheduledInvocationReason

I am trying to diagnose this error when my timer function runs. I have not found much help on this on google search
UnscheduledInvocationReason: IsPastDue, OriginalSchedule: 2019-06-13T15:13:00.0000000-07:00
It seems like the process just stops when this error comes.
Anyone have any insight on this?
The IsPastDue flag is passed to your azure function to indicate if the timer was overdue or not. A timer function can run late in some scenarios like the app service was restarted, in this case it is still invoked but the IsPastDue flag will be set to true to give your function a chance to react.
These links are helpful
Timer trigger for Azure Functions
Also, it seems that it was an issue and it is submitted on github but that was on 2017
TimerTrigger can miss IsPastDue
Got this error locally.
[2021-06-16T14:58:22.779Z] Executing 'Functions.TimerTrigger'
(Reason='Timer fired at 2021-06-16T16:58:22.7688953+02:00',
Id=adbaee54-8a3e-4983-a7e4-a73f69153e5e) [2021-06-16T14:58:22.780Z]
Trigger Details: UnscheduledInvocationReason: IsPastDue,
OriginalSchedule: 2021-06-16T16:37:00.0000000+02:00
[2021-06-16T14:59:22.614Z] Starting worker process failed
[2021-06-16T14:59:22.615Z] The operation has timed out.
Solved by clearing Blob Emulator locally:
delete
FROM [AzureStorageEmulatorDb510].[dbo].[Blob]

Resources