Skip to content

[Az.Functions] Fix stacks parser for runtime definitions without FUNCTIONS_WORKER_RUNTIME#29816

Open
Francisco-Gamino wants to merge 1 commit into
Azure:mainfrom
Francisco-Gamino:functions/fix-stacks-parser
Open

[Az.Functions] Fix stacks parser for runtime definitions without FUNCTIONS_WORKER_RUNTIME#29816
Francisco-Gamino wants to merge 1 commit into
Azure:mainfrom
Francisco-Gamino:functions/fix-stacks-parser

Conversation

@Francisco-Gamino

Copy link
Copy Markdown
Contributor

Description

The PR contains the following changes:

  • Fixes [Az-Functions] Failed to get Function App Stack definitions from ARM API #29630 - Updated the Function App stacks parser to handle runtime definitions that do not include a FUNCTIONS_WORKER_RUNTIME app setting. While generating Function App runtime tab-completion entries, the module reads Function App stack definitions. Some stacks (for example, Go on Flex Consumption) do not define a FUNCTIONS_WORKER_RUNTIME app setting, which previously caused a null-key lookup exception.
  • Updated Function App stack definitions to the latest version.

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

FUNCTIONS_WORKER_RUNTIME app setting. While generating Function App runtime
tab-completion entries, the module reads Function App stack definitions. Some
stacks (for example, Go on Flex Consumption) do not define a
`FUNCTIONS_WORKER_RUNTIME` app setting, which previously caused a null-key
lookup exception. GetRuntimeName looked up that missing key and threw, which
caused every Az.Functions cmdlet to fail on module import / first use while
building the runtime tab completers.

- GetRuntimeName now returns $null when FUNCTIONS_WORKER_RUNTIME is absent.
- SetLinuxandWindowsSupportedRuntimes skips Linux stacks without a mappable
  runtime name instead of throwing.
- Refreshed the bundled functionAppStacks.json (now includes the Go stack).
- Added regression tests in SetLinuxandWindowsSupportedRuntimes.Tests.ps1.
Copilot AI review requested due to automatic review settings July 7, 2026 04:08
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@Francisco-Gamino Francisco-Gamino changed the title [Functions] Fix stacks parser for runtime definitions without FUNCTIONS_WORKER_RUNTIME [Az.Functions] Fix stacks parser for runtime definitions without FUNCTIONS_WORKER_RUNTIME Jul 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash in Az.Functions runtime tab-completion generation by updating the Function App stacks parser to tolerate stack definitions that omit the FUNCTIONS_WORKER_RUNTIME app setting (e.g., Go on Flex Consumption), and refreshes the bundled stack definition data.

Changes:

  • Updated GetRuntimeName / runtime parsing flow to avoid null-key lookups when FUNCTIONS_WORKER_RUNTIME is absent.
  • Added regression tests covering missing FUNCTIONS_WORKER_RUNTIME scenarios.
  • Updated bundled functionAppStacks.json stack definitions and added a changelog entry for issue [#29630].

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/Functions/Functions/ChangeLog.md Adds an Upcoming Release entry for the fix and stack definition refresh.
src/Functions/Functions.Autorest/test/SetLinuxandWindowsSupportedRuntimes.Tests.ps1 Adds regression coverage for stacks missing FUNCTIONS_WORKER_RUNTIME.
src/Functions/Functions.Autorest/custom/HelperFunctions.ps1 Implements the parser/runtime-name handling change and skip logic for unmappable stacks.
src/Functions/Functions.Autorest/custom/FunctionsStack/functionAppStacks.json Updates the local snapshot of Function App stack definitions (including Go/Flex Consumption).

Comment on lines +8 to +10
if (-Not (Test-Path -Path $loadEnvPath)) {
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
}
Comment on lines +2340 to +2347
if ($runtime -and -not [string]::IsNullOrWhiteSpace($runtime.Name))
{
AddRuntimeToDictionary -Runtime $runtime -RuntimeToVersionDictionary ([Ref]$RuntimeToVersionLinux)
}
elseif ($runtime -and $skippedRuntimeStacks.Add($stackName))
{
Write-Verbose "Skipping runtime stack '$stackName' while building runtime tab-completion data; it is currently in preview and not yet supported by this module."
Write-Debug "$DEBUG_PREFIX Skipping runtime stack '$stackName'; no mappable runtime name (preview/unsupported)."
Comment on lines +21 to +22
* Updated the Function App stacks parser to handle a runtime definition that does not
include a `FUNCTIONS_WORKER_RUNTIME` app setting. Update Function App stack definitions. [#29630]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Az-Functions] Failed to get Function App Stack definitions from ARM API

3 participants