[Az.Functions] Fix stacks parser for runtime definitions without FUNCTIONS_WORKER_RUNTIME#29816
Open
Francisco-Gamino wants to merge 1 commit into
Open
[Az.Functions] Fix stacks parser for runtime definitions without FUNCTIONS_WORKER_RUNTIME#29816Francisco-Gamino wants to merge 1 commit into
Francisco-Gamino wants to merge 1 commit into
Conversation
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.
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
Contributor
There was a problem hiding this comment.
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 whenFUNCTIONS_WORKER_RUNTIMEis absent. - Added regression tests covering missing
FUNCTIONS_WORKER_RUNTIMEscenarios. - Updated bundled
functionAppStacks.jsonstack 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The PR contains the following changes:
FUNCTIONS_WORKER_RUNTIMEapp setting, which previously caused a null-key lookup exception.Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.