Azure / azure-functions-durable-extension

Durable Task Framework extension for Azure Functions
MIT License
716 stars 271 forks source link

durableTask's host.json notifications eventGrid topicEndpoint using environment variables #2935

Closed ryryNguyen closed 1 month ago

ryryNguyen commented 1 month ago

Hi there,

I have question regarding whether the this variable eventGridTopicEndpoint in the host.json is able to reference the application's environment variables?

Currently, I've deployed the application with the following setting, where EVENT_GRID_TOPIC_ENDPOINT is set using the following format detailed in Durable Functions 2.x, i.e., https://<topic_name>.westus2-1.eventgrid.azure.net/api/events host.json

I've verified that the application's environment variable EVENT_GRID_TOPIC_ENDPOINT is correct, however, I am still seeing the following logs

2024-10-10T20:11:18.700 [Error] INSTANCEID: Function 'orchestrator_function (Orchestrator)' failed to send a 'Started' notification event to Azure Event Grid. Status code: 404. Details: {
    "error": {
        "code": "NotFound",
        "message": "No HTTP resource was found that matches the request URI 'https://eg-topic.southcentralus-1.eventgrid.azure.net/api/event'. Report 'c87af8bb-0416-44d8-91a5-74e77f5880c2:2:10/10/2024 8:11:18 PM (UTC)' to our forums for assistance or raise a support ticket.",
        "details": [{
            "code": "ResourceNotFound",
            "message": "No HTTP resource was found that matches the request URI 'https://eg-topic.southcentralus-1.eventgrid.azure.net/api/event'. Report 'c87af8bb-0416-44d8-91a5-74e77f5880c2:2:10/10/2024 8:11:18 PM (UTC)' to our forums for assistance or raise a support ticket."
    }]
  }

I am using the following ExtensionBundle version

"version": "[4.0.0, 5.0.0)"
cgillum commented 1 month ago

Yes, you can reference environment variables just like you've shown in your example. From your error message, it actually appears to be working since the message is referencing a real URL and not the literal string, "%EVENT_GRID_TOPIC_ENDPOINT%".

In your case, where is the URL https://eg-topic.southcentralus-1.eventgrid.azure.net/api/event coming from?

ryryNguyen commented 1 month ago

@cgillum Thank you for your prompt response!

As I am writing this, this is 100% on me🤦. I just realized that I accidentally forgot a "s" in events Instead of https://eg-topic.southcentralus-1.eventgrid.azure.net/api/event it should have been https://eg-topic.southcentralus-1.eventgrid.azure.net/api/events. I've verified that it is working as soon as I corrected it. Thank you!