Azure Function Host return internal server error on Swap operation.

See original GitHub issue

Check for a solution in the Azure portal

Diagnose and solve problems gave no insights into this problem.

Linux Consumption Azure function with deployment slot. I want to swap my production slot and the staging slot, I’ve tried the Azure Portal UI which throws a rather verbose error message with a 500 error code in it. Then tried to activate auto-swap through Terraform and get a different error there.

The investigative information below is just to locate the app, the swap errors are present in the activity log at:

  • Tue Mar 15 2022 14:19:37 GMT+0100 (Central European Standard Time)
  • Tue Mar 15 2022 14:13:43 GMT+0100 (Central European Standard Time)
  • Tue Mar 15 2022 14:11:10 GMT+0100 (Central European Standard Time)

Investigative information

Please provide the following:

  • Timestamp: 2022-03-15 03:04:37.635
  • Function App version: 3
  • Function App name:
  • Function name(s) (as appropriate):
  • Invocation ID: 16602e74-84ba-45d5-9260-dd932227fcd6
  • Region: West Europe

Repro steps

I and you can repro this, just navigate to either Function or Function slot, hit the swap button and get presented with error. It’s a dev environment so I have no problem if you try this yourself anytime to verify/debug. 😃

Expected behavior

Expect application to swap slots.

Actual behavior

Azure portal throws the following: Failed to complete swap between slot 'func-slot' and slot 'production'. Error: {"_body":"{\"Code\":\"InternalServerError\",\"Message\":\"There was an unexpected error swapping slots 'func-slot' and 'production' for site 'func(func-slot)'. Please try to cancel your swap operation.\",\"Target\":null,\"Details\":[{\"Message\":\"There was an unexpected error swapping slots 'func-slot' and 'production' for site 'func(func-slot)'. Please try to cancel your swap operation.\"},{\"Code\":\"InternalServerError\"},{\"ErrorEntity\":{\"ExtendedCode\":\"04093\",\"MessageTemplate\":\"There was an unexpected error swapping slots '{0}' and '{1}' for site '{2}'. Please try to cancel your swap operation.\",\"Parameters\":[\"func-slot\",\"production\",\"func(func-slot)\"],\"Code\":\"InternalServerError\",\"Message\":\"There was an unexpected error swapping slots 'func-slot' and 'production' for site 'func(func-slot)'. Please try to cancel your swap operation.\"}}],\"Innererror\":null}","status":500,"ok":false,"statusText":"OK","headers":{"cache-control":["no-cache"],"content-length":["1106"],"content-type":["application/json; charset=utf-8"],"date":["Tue"," 15 Mar 2022 13:11:10 GMT"],"etag":["\"1D8386E165ECFE0\""],"expires":["-1"],"pragma":["no-cache"],"server":["Microsoft-IIS/10.0"],"strict-transport-security":["max-age=31536000; includeSubDomains"],"x-aspnet-version":["4.0.30319"],"x-ms-correlation-request-id":["41a5a379-b64d-4747-a868-7fd226587f27"],"x-ms-failure-cause":["service"],"x-ms-ratelimit-remaining-subscription-writes":["1198"],"x-ms-request-id":["41a5a379-b64d-4747-a868-7fd226587f27"],"x-ms-routing-request-id":["GERMANYNORTH:20220315T131110Z:41a5a379-b64d-4747-a868-7fd226587f27"],"x-powered-by":["ASP.NET"]},"type":2,"url":"https://management.azure.com/subscriptions/[redacted:)]/resourceGroups/[redacted:)]/providers/Microsoft.Web/sites/func/slots/func-slot/slotsswap?api-version=2018-11-01"}

Known workarounds

Sorry, no known workaround what I’ve found

Related information

Provide any related information

  • Programming language used C# .Net Core
  • Links to source
  • Bindings used

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Ved2806commented, Mar 21, 2022

Hi @pragnagopa Could you please direct us to the right person to investigate the issue further?

0reactions
olajcommented, May 25, 2022

FYI

I got some more info in the “Health & Diagnostics” thing in the portal, the error there said “There was a conflict. VnetRouteAllEnabled has diffirent values as site property and site config”

I do use a vnet for my production slot but i didn’t have one for my staging slot. I then added a vnet for my staging slot and when it was created the option VnetRouteAllEnabled was enabled. I then disabled that and tried to swap and then it worked.

Note that i didn’t have an issue with a function app but a Linux web app, but i suppose it’s the same more or less.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure function swap fails with internal server error
My Azure function has a staging and production slot. Both have vnet enabled, and have WEBSITE_CONTENTOVERVNET=1 & vnetRouteAllEnable=true.
Read more >
Azure functions swap functionality is not working after ...
This was caused by an internal platform component, and I'll updated this question to notify when the component fix has been fully released....
Read more >
FIX: An error has occurred VSC deploying to Azure Functions
BadRequest Encountered an error (InternalServerError) from host runtime. 'An error has occurred' Azure Functions. I'm guessing this falls under ...
Read more >
Azure Functions and its Complete Overview
An instance will be mapped with the Production environment and It can be swapped on Demand. Swapping can be done either through the...
Read more >
How to fix Azure Functions Timer Trigger unable to start ...
Azure.Storage.Blobs: Service request failed. This error is related to Azurite (the local Azure Functions runtime environment).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found