Azure / Azure/azure-functions-host

Unable to leverage WEBSITE_SWAP_WARMUP_PING_PATH with WEBSITE_SWAP_WARMUP_PING_STATUSES for deployment swaps

Open
#6,942 2 comments 1 reaction 1 assignee Claimed by @mhoeger View on GitHub
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

#### Check for a solution in the Azure portal
(None found)

#### Investigative information

Please provide the following:

- Timestamp: Tue Nov 24 2020 13:26:37 GMT-0800 (Pacific Standard Time)
- Function App version: 3.0.14916
- Function App name: abbot-skills-csharp
- Function name(s) (as appropriate): Warmup
- Invocation ID:
- Region: West US 2

#### Repro steps

Provide the steps required to reproduce the problem:

1. Create a C# function named `Warmup`.
2. Set up a staging deployment slot and enable auto-swap.
3. Make sure `Warmup` is deployed to both stage and prod.
4. In both slots, add the app setting `WEBSITE_SWAP_WARMUP_PING_PATH` with value `/api/warmup` and `WEBSITE_SWAP_WARMUP_PING_STATUSES` with value `200`.
5. Deploy to the staging slot.

#### Expected behavior

When deploying to stage, Azure Functions should ping the warmup ping path, call by Warmup function, get a 200 response, and then swap stage with production.

#### Actual behavior

The swap fails because the ping received an HTTP 401 status code. My function is never called.

The reason for this, as far as I understand, is that normally, in order to invoke a function, you have to pass an access code in the query string. I thought that maybe the ping request would bypass this requirement because it's made by an internal system.

An easy fix would be for me to set code in the query string of the warmup path, but you cannot specify a query string in `WEBSITE_SWAP_WARMUP_PING_PATH` because the value of `WEBSITE_SWAP_WARMUP_PING_PATH` is encoded by Azure before it pings it.

So if you were to try and set `WEBSITE_SWAP_WARMUP_PING_PATH` to `/api/warmup?code=SECRET` the actual request that's made is `/api/warmup%3Fcode=SECRET`. This makes the combination of these two setting with Azure Functions impossible to use.

#### Known workarounds

As far as I know, there are no known workarounds.

#### Related information

Provide any related information

This is similar to the HTTPS issue I wrote about a while back: https://haacked.com/archive/2020/09/28/azure-swap-with-warmup-aspnetcore/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.