You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add VS Code debugging for Node Azure Functions - #20943
Adds the VS Code extension debugger follow-up split from #17980 so TypeScript and JavaScript Azure Functions apps can be launched under Core Tools and attached with the Node debugger.
The parent #17980 has merged. This PR targets main and preserves the parent's final constructor validation, deployment subscription handling, and .npmrc build-context exclusion.
Restores effective environment propagation, inspector-port reservation through task launch, separate Node Functions E2E prerequisites, handled-exception diagnostics, documentation, and tests.
The external-consumer Node Functions E2E fixture uses Microsoft.NET.Sdk, AspireUseCliBundle, and matching PR-built Aspire.Hosting.AppHost and Aspire.Hosting.Azure.Functions packages. It does not reference the repository project, avoiding mixed repository-central and external transitive Azure Storage versions. The fixture gets its package version from the E2E runner instead of assuming the generated template contains the now-deprecated Aspire.AppHost.Sdk directive.
User-facing usage
With the Aspire VS Code extension installed, debugging an AppHost containing a TypeScript or JavaScript Azure Functions app starts Azure Functions Core Tools, reserves a loopback Node inspector port until task launch, attaches pwa-node, and stops the task when the debug session ends.
The playground launch configuration demonstrates the scenario with AzureFunctionsWithStorage.
Screenshots are not useful evidence for this debugger-orchestration change. The passing live Node Functions E2E proof installs real source breakpoints, sends an HTTP request, verifies the pwa-node stack frame, and verifies Core Tools and the inspector are cleaned up.
Validation
CI run 38341117446 passed for head 2ea2231f0fae7f3cd2c3d89a614a06fc7de3cb51, including the live Node Functions debugger E2E and final results gate. All 104 visible PR checks finished successfully or were intentionally skipped; none remain pending or failing.
Local validation after the package-based fixture fix:
Passed: cd extension && corepack yarn run compile-e2e
Passed: cd extension && corepack yarn run compile-tests
Passed: cd extension && corepack yarn run lint
Passed (170 tests): cd extension && corepack yarn run unit-test --grep "Azure Functions|E2E launch profile|E2E shard matrix"
Earlier post-rebase validation:
Passed (3,665 tests; 16 pending, plus compile and lint): cd extension && corepack yarn test
Initial validation also passed ./restore.sh and export PATH="$PWD/.dotnet:$PATH" && dotnet build src/Aspire.Hosting.Azure.Functions/Aspire.Hosting.Azure.Functions.csproj /p:SkipNativeBuild=true --no-restore.
Host limitation: an initial combined build attempt encountered Xcode-dependent CLI/dashboard targets on this macOS host, which has Command Line Tools rather than full Xcode. Local targeted validations passed independently, and the current CI run passed its selected builds and tests.
Fixes # (issue)
Checklist
Is this feature complete?
Yes. Ready to ship.
No. Follow-up changes expected.
Are you including unit tests for the changes and scenario tests if relevant?
Yes
No
Did you add public API?
Yes
If yes, did you have an API Review for it?
Yes
No
Did you add <remarks /> and <code /> elements on your triple slash comments?
Yes
No
No
Does the change make any security assumptions or guarantees?
Yes
If yes, have you done a threat model and had a security review?
## Description
This adds a proof-of-concept path for Azure Functions apps that are not
.NET projects, starting with TypeScript and JavaScript on the Node
worker. The goal is to let a TypeScript AppHost model, run, publish, and
deploy a TypeScript Azure Functions app the same way it models the rest
of a distributed app.
The change introduces a directory-based Azure Functions app resource,
local Core Tools launch behavior, and deterministic Dockerfile
publishing for TypeScript/JavaScript Functions containers.
VS Code debugger support was split into the stacked follow-up #20943 so
the hosting and deployment support can land independently.
A new playground sample demonstrates the scenario end to end: a
TypeScript AppHost, TypeScript Azure Function, Azure Storage dependency,
and Vite TypeScript frontend. Locally, the frontend proxies `/api` to
the Aspire-modeled Functions endpoint. In Azure Container Apps, the
frontend is published as a static site with `/api` routed to the
Functions container.
Related to #17979
### User-facing usage
TypeScript AppHost:
```typescript
const functions = await builder
.addAzureFunctionsApp("functions", "../Functions", AzureFunctionsLanguage.TypeScript)
.withExternalHttpEndpoints()
.withReference(samples).waitFor(samples);
await builder
.addViteApp("frontend", "../Frontend")
.withEnvironment("FUNCTIONS_BASE_URL", functions.getEndpoint("http"))
.waitFor(functions)
.publishAsStaticWebsite({
apiPath: "/api",
apiTarget: functions
})
.withExternalHttpEndpoints();
```
Generated TypeScript Functions Dockerfile publish uses the official
Functions Node host image shape, builds TypeScript during container
build, and exposes container port 80 for ACA `kind: functionapp`
deployment.
### Security considerations
This change adds support for launching Node-based Azure Functions apps
locally and publishing them as containers. The sample frontend adds a
static-site reverse proxy route from `/api` to the Functions resource.
Security review has not been completed yet because this is a POC.
### Validation
- Passed: `./restore.sh`
- Passed (67 tests): `dotnet test --project
tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj
--no-launch-profile -- --filter-class "*.AzureFunctionsTests"
--filter-class "*.FunctionsPublicApiTests" --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"`
- Passed: `dotnet build
tests/Aspire.Deployment.EndToEnd.Tests/Aspire.Deployment.EndToEnd.Tests.csproj
--no-restore --nologo`
- Clean isolated local `aspire start` for the TypeScript AppHost
- `aspire wait functions` and `aspire wait frontend`
- Local frontend `/api/storageHttpTrigger?name=Frontend` call wrote a
blob to the modeled `samples` container
- `aspire publish` emitted Functions and frontend container artifacts,
including ACA Bicep, Functions `kind: 'functionapp'`, target port 80,
frontend YARP static-site routing, and storage role assignments
- Real `aspire deploy` to ACA in `rg-aspire-ts-functions-poc` succeeded
- Deployed frontend `/api/storageHttpTrigger?name=ACAFrontend` returned
HTTP 200 and wrote a blob
- Passed: `git diff --check`
Fixes # (issue)
## Checklist
- Is this feature complete?
- [ ] Yes. Ready to ship.
- [x] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] Yes
- [ ] No
- Did you add public API?
- [x] Yes
- If yes, did you have an API Review for it?
- [ ] Yes
- [x] No
- Did you add `<remarks />` and `<code />` elements on your triple slash
comments?
- [ ] Yes
- [x] No
- [ ] No
- Does the change make any security assumptions or guarantees?
- [x] Yes
- If yes, have you done a threat model and had a security review?
- [ ] Yes
- [x] No
- [ ] No
---------
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Mitch Denny <[email protected]>
Copilot-Session: 9758c021-6791-46c1-81f0-c31dd977b996
Copilot-Session: ba624858-8d8b-431c-afa7-b672f0c74ac2
Restore the reviewed extension debugger support split from the Functions language changes, and keep the external-consumer E2E fixture on the PR-built Azure Functions hosting package.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 36c01d16-3dc7-4ef2-80cc-1a0f40c862ca
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The new launch type is not tracked for editor assistance, and the existing documented .NET Functions E2E command no longer installs its required debugger extensions.
This overwrites any user-provided languageWorkers__node__arguments already present in effectiveEnv, so Node worker flags such as memory or diagnostics settings silently disappear whenever debugging starts. Preserve the existing arguments while adding the inspector option, with explicit handling for an existing inspector flag, and cover that case in the environment-propagation test.
Localize debug-session labels through the extension localization path
These values become user-visible debug-session names, but the new labels bypass the extension localization path. Define localized formatter/fallback strings in extension/src/loc/strings.ts (and the catalog) and use them here so non-English VS Code sessions can translate the label.
Read the PR package version from the E2E runner instead of assuming the template emits an Aspire.AppHost.Sdk directive. Match the current Microsoft.NET.Sdk and Aspire.Hosting.AppHost package-based template while keeping Functions package versions aligned.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 36c01d16-3dc7-4ef2-80cc-1a0f40c862ca
restart: true keeps the attach session alive and waiting for the inspector to reappear when the Node worker exits. Because Core Tools is launched as a separate task and this path never subscribes to that task's end event, a crashed or failed Functions host leaves Aspire with a resource debug session that waits indefinitely instead of terminating. Track the exact TaskExecution with onDidEndTaskProcess and stop the corresponding debug session when the host task ends; retain restart only for worker restarts while that task is still running.
The reason will be displayed to describe this comment to others. Learn more.
I reviewed the Node Functions launch metadata, capability negotiation, Core Tools/inspector lifecycle, environment handling, and the unit/E2E/CI changes.
I found one additional console-log forwarding issue beyond the feedback already raised.
Map azure-functions-node launch configurations to their structured app directory and cover TypeScript, JavaScript, and empty path handling.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 36c01d16-3dc7-4ef2-80cc-1a0f40c862ca
This overwrites any languageWorkers__node__arguments supplied by the AppHost or the user's debugger configuration. That setting carries all Node worker arguments, so debugging currently drops non-inspector flags and can change application behavior. Preserve the existing non-inspector arguments while replacing or appending the allocated --inspect option, and cover that case in the effective-environment test.
This issue also appears on line 844 of the same file.
executeTask is launched but its process lifetime is never observed. If Core Tools exits because of invalid host configuration, a port conflict, or a later crash, the restart: true attach session can remain waiting for an inspector after DCP has marked the resource running, and the task/port cleanup remains registered until the user stops the run. Register onDidEndTaskProcess before launch, match the exact task/execution as the .NET Functions path does at lines 957-988, and fail or terminate this resource session; add an early-task-exit regression test.
Exclude handled exceptions from breakpoint stop detection
Handled exception events are still added to stoppedEvents before they are continued. waitForBreakpoint scans this array without checking reason, so a handled exception whose stack lands on the requested AppHost line can satisfy the proof as if the source breakpoint fired; the new E2E test also does not assert the AppHost stop reason. Keep these handled events only in exceptionStops so they cannot satisfy breakpoint waits.
The reason will be displayed to describe this comment to others. Learn more.
I reviewed the Node Functions launch metadata and capabilities, debugger configuration, Core Tools/inspector lifecycle, environment propagation, and the test/CI changes. I didn't find additional high-confidence issues beyond the feedback already raised.
I locally exercised the PR's debugger callback in a real VS Code Extension Development Host on Windows ARM64 using Core Tools 4.12.1 and Node 22. With default attach settings, pwa-node hit the JavaScript HTTP-handler source breakpoint, the request returned the expected response, and cleanup ended the same Core Tools task and closed the inspector port.
The 40 focused debugger, DCP, Functions launch-profile, and shard-matrix tests passed. Extension compilation, test compilation, E2E compilation, and lint also passed. The live proof used a temporary harness; I didn't rerun the full packaged AppHost E2E or verify TypeScript source-map breakpoints locally.
Documented the VS Code extension's new Node.js/TypeScript Azure Functions debugger behavior introduced by this PR. Triggered signals: pr_body_has_user_facing_section (PR body's "User-facing usage" section describes starting Core Tools, reserving a loopback Node inspector port, and attaching pwa-node), pr_body_has_cli_flag_mention (references to extension test commands), and pr_body_has_deprecation_marker (mentions the deprecated Aspire.AppHost.Sdk directive, not itself a doc-worthy change). Updated src/frontend/src/content/docs/get-started/aspire-vscode-extension.mdx's "Language coverage" section with a short paragraph explaining the Node-worker Core Tools/pwa-node attach flow and the new debuggers["azure-functions-node"] launch.json key, based on extension/src/debugger/languages/azureFunctions.ts and extension/src/capabilities.ts diffs.
## Summary
<!-- Describe what this pull request changes and why. -->
Documents the VS Code debugging support added by microsoft/aspire#20943
for JavaScript and TypeScript Azure Functions apps.
- Explain loopback inspector-port reservation until task launch, Azure
Functions Core Tools task startup, and attachment with VS Code's
built-in `pwa-node` debugger.
- Document the supported cleanup direction: stopping the Aspire debug
session stops the Functions task.
- Add `azure-functions-node` to the existing debugger configuration keys
and explain when to use it instead of `node`.
- Split Azure Functions language coverage into C#/.NET and
JavaScript/TypeScript rows, with the correct debugger and extension
requirements.
Targets `release/17.0`, matching the source PR's milestone.
Implementation details were verified against the source PR's merge
commit `4de47f1f1b0078ee62dc25f5a03b30e1e1ee9471`.
## Third-party links and affiliations
<!--
List any third-party links added or changed by this pull request and
disclose any
material affiliation with the linked organizations, such as employment,
sponsorship, or ownership. Write "None" if this pull request doesn't add
or
change third-party links.
-->
None. The table reuses the existing Microsoft VS Code Marketplace links.
## Validation
<!-- List the checks you ran or explain why validation isn't needed. -->
- `git diff --check`: passed.
- MDX syntax compilation with table support: passed. Exact command, run
from `src/frontend`:
```powershell
node --input-type=module -e 'import { readFile } from "node:fs/promises"; import { compile } from "@mdx-js/mdx"; import remarkGfm from "remark-gfm"; await compile(await readFile("src/content/docs/get-started/aspire-vscode-extension.mdx", "utf8"), { remarkPlugins: [remarkGfm] }); console.log("Edited MDX compiles successfully.");'
```
- The earlier local browser preview verified the new configuration-key
guidance and both language-specific table rows. A repeat preview for the
final paragraph correction was attempted with `pnpm --dir src\frontend
dev` and `npx --yes @playwright/cli -s=docs1889-correction open
http://localhost:4321/get-started/aspire-vscode-extension/`, but could
not connect before the preview was stopped; final rendering was not
reverified.
- Source verification confirms inspector-port reservation, Core Tools
task startup, `pwa-node` attachment, cleanup of the Functions task when
the Aspire debug run stops, and independent registration of the Node
Functions debugger without the Azure Functions VS Code extension.
The browser and temporary dev server were stopped. No production build
or full test suite was run for this prose/table-only change.
<!-- gh-aw-agentic-workflow: PR Documentation Check, engine: copilot,
model: auto, id: 38497052797, workflow_id: pr-docs-check, run:
https://github.com/microsoft/aspire/actions/runs/38497052797 -->
<!-- gh-aw-workflow-id: pr-docs-check -->
<!-- gh-aw-workflow-call-id: microsoft/aspire/pr-docs-check -->
---------
Co-authored-by: aspire-repo-bot[bot] <268009190+aspire-repo-bot[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Ella Hathaway <[email protected]>
Copilot-Session: 6c564cc7-36e2-4cac-b334-c50fb7faa6b6
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
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
Adds the VS Code extension debugger follow-up split from #17980 so TypeScript and JavaScript Azure Functions apps can be launched under Core Tools and attached with the Node debugger.
The parent #17980 has merged. This PR targets
mainand preserves the parent's final constructor validation, deployment subscription handling, and.npmrcbuild-context exclusion.Restores effective environment propagation, inspector-port reservation through task launch, separate Node Functions E2E prerequisites, handled-exception diagnostics, documentation, and tests.
The external-consumer Node Functions E2E fixture uses
Microsoft.NET.Sdk,AspireUseCliBundle, and matching PR-builtAspire.Hosting.AppHostandAspire.Hosting.Azure.Functionspackages. It does not reference the repository project, avoiding mixed repository-central and external transitive Azure Storage versions. The fixture gets its package version from the E2E runner instead of assuming the generated template contains the now-deprecatedAspire.AppHost.Sdkdirective.User-facing usage
With the Aspire VS Code extension installed, debugging an AppHost containing a TypeScript or JavaScript Azure Functions app starts Azure Functions Core Tools, reserves a loopback Node inspector port until task launch, attaches
pwa-node, and stops the task when the debug session ends.The playground launch configuration demonstrates the scenario with
AzureFunctionsWithStorage.Screenshots are not useful evidence for this debugger-orchestration change. The passing live Node Functions E2E proof installs real source breakpoints, sends an HTTP request, verifies the
pwa-nodestack frame, and verifies Core Tools and the inspector are cleaned up.Validation
CI run 38341117446 passed for head
2ea2231f0fae7f3cd2c3d89a614a06fc7de3cb51, including the live Node Functions debugger E2E and final results gate. All 104 visible PR checks finished successfully or were intentionally skipped; none remain pending or failing.Local validation after the package-based fixture fix:
cd extension && corepack yarn run compile-e2ecd extension && corepack yarn run compile-testscd extension && corepack yarn run lintcd extension && corepack yarn run unit-test --grep "Azure Functions|E2E launch profile|E2E shard matrix"Earlier post-rebase validation:
cd extension && corepack yarn testexport PATH="$PWD/.dotnet:$PATH" && dotnet test --project tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj --no-launch-profile -- --filter-method "*.AddAzureFunctionsApp_DoesNotModelNodeDebugEndpoint" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"Initial validation also passed
./restore.shandexport PATH="$PWD/.dotnet:$PATH" && dotnet build src/Aspire.Hosting.Azure.Functions/Aspire.Hosting.Azure.Functions.csproj /p:SkipNativeBuild=true --no-restore.Host limitation: an initial combined build attempt encountered Xcode-dependent CLI/dashboard targets on this macOS host, which has Command Line Tools rather than full Xcode. Local targeted validations passed independently, and the current CI run passed its selected builds and tests.
Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?