azure-functions-host
azure-functions-host copied to clipboard
Slot Swap Feature - Send signal to function extension on hostname/routing swap completes.
What problem would the feature you're requesting solve? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Azure Logic Apps is introducing zero downtime deployment by taking advantage of slot support in Azure Functions. Our workers depend on hostname and are initialized/registered during extension startup. During a swap, hostname/routing is updated after startup under the covers without recycling the app. The issue is once swap is complete, our workers reference the non-production hostname in a production slot.
At startup, we get the endpoint by calling context.GetWebhookHandler()
, see code in Repo: WorkflowExtensionProvider.cs
WorkflowExtensionProvider
initialize classes that are used to build URLs displayed in the portal but also in other components, such as webhook and HTTP triggers, callback URLs and inputs/outputs URLs
An example of the issue is that in the portal, the end-user will see the staging hostname in production slot. Below is one example.
Describe the solution you'd like
A clear and concise description of what you want to happen.
The ideal solution is for Azure Logic Apps to subscribe or depend on a signal from host runtime when hostname/routing is updated during a swap. This ask will allow us to delay worker initialization/registration until hostname is updated. In addition, it would be helpful to know that the startup was triggered by a swap. This will help us to differentiate between, normal app recycle, and swap app recycle.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
We looked into synching the hostname after startup, however, there is no reliable path to perform the synch at the "right time". The solution/workaround implemented in HostNameProvider.cs is not a viable solution/workaround for us.
Additional context
Add any other context or screenshots about the feature request here.
Below is a screenshot of environment variables available at swap restart.