Skip to content

Comments

fix(recipes): Add entry point guidance for Node.js and C# - Issue #852#995

Open
paulyuk wants to merge 11 commits intomicrosoft:mainfrom
paulyuk:paulyuk/fix-852
Open

fix(recipes): Add entry point guidance for Node.js and C# - Issue #852#995
paulyuk wants to merge 11 commits intomicrosoft:mainfrom
paulyuk:paulyuk/fix-852

Conversation

@paulyuk
Copy link
Member

@paulyuk paulyuk commented Feb 20, 2026

Problem

Azure Functions deployed with our recipes return 404 on all endpoints (Issue #852).

Root Cause Analysis

Node.js v4 programming model requires src/index.js (or src/index.ts) with app.setup() call. Without it, functions deploy but the runtime never discovers the registered endpoints.

C# .NET isolated worker recipes were replacing the base template's Program.cs (which uses ConfigureFunctionsWebApplication()) with an outdated version using ConfigureFunctionsWorkerDefaults().

Changes

Node.js (16 files)

  • Created common/nodejs-entry-point.md documenting required entry point
  • Updated all 8 JavaScript recipes with warning header
  • Updated all 8 TypeScript recipes with warning + build guidance

C# (3 files)

  • Created common/dotnet-entry-point.md documenting correct patterns
  • Removed outdated Program.cs sections from timer, servicebus, durable recipes
  • Added warning to not replace base template's Program.cs

Composition Algorithm

  • Added critical warnings for both languages in Step 5

Tests/Evals

  • Added Node.js entry point grader to eval.yaml
  • Added missing TypeScript fixture file (src/index.ts)

Summary

Category Files Changed Impact
JS recipes 8 Warning added
TS recipes 8 Warning + build guidance
C# recipes 3 Bad Program.cs removed
Common docs 2 new Entry point guidance
Tests 2 Improved eval coverage

Fixes #852

…rosoft#852

Node.js v4 programming model requires src/index.js with app.setup() call.
Without it, functions deploy but return 404 on all endpoints.

C# .NET isolated worker should NOT replace Program.cs from base template.
Base template uses ConfigureFunctionsWebApplication() which is required.

Changes:
- Add common/nodejs-entry-point.md documentation
- Add common/dotnet-entry-point.md documentation
- Update all 16 JS/TS recipes with entry point warning
- Update 3 C# recipes to remove outdated Program.cs sections
- Add Node.js entry point grader to eval.yaml
- Add missing TypeScript fixture file
- Update composition.md with critical warnings for both languages

Fixes microsoft#852

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 20, 2026 23:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Addresses Azure Functions “deploys but returns 404” failures (Issue #852) by documenting and reinforcing required entry-point patterns for Node.js v4 (app.setup() in src/index.*) and .NET isolated worker (keep base template Program.cs using ConfigureFunctionsWebApplication()), and by extending eval coverage to catch regressions.

Changes:

  • Add shared “entry point” guidance docs for Node.js and .NET recipes and link them from recipes/composition guidance.
  • Update multiple JS/TS recipes with explicit warnings to preserve src/index.(js|ts) and (for TS) to run npm run build.
  • Extend azure-prepare eval suite with a new grader and add a missing TS fixture entry point file.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/azure-prepare/eval/fixtures/typescript-http/src/index.ts Adds TS fixture entry point calling app.setup()
tests/azure-prepare/eval/eval.yaml Adds a new grader intended to detect missing Node.js entry-point guidance
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/source/typescript.md Adds warning to keep src/index.ts + TS build note
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/source/javascript.md Adds warning to keep src/index.js
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/source/dotnet.md Removes outdated Program.cs snippet; adds “don’t modify Program.cs” warning
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/typescript.md Adds common-pattern link to Node.js entry-point doc
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/javascript.md Adds common-pattern link to Node.js entry-point doc
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/typescript.md Adds warning to keep src/index.ts + TS build note + common-pattern link
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/javascript.md Adds warning to keep src/index.js + common-pattern link
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/dotnet.md Removes outdated Program.cs snippet; adds “don’t modify Program.cs” warning
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/typescript.md Adds warning to keep src/index.ts + TS build note
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/javascript.md Adds warning to keep src/index.js
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/source/typescript.md Adds common-pattern link to Node.js entry-point doc
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/source/javascript.md Adds common-pattern link to Node.js entry-point doc
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/source/typescript.md Adds warning to keep src/index.ts + TS build note
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/source/javascript.md Adds warning to keep src/index.js
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/source/dotnet.md Removes outdated Program.cs snippet; adds “don’t modify Program.cs” warning
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/source/typescript.md Adds common-pattern link to Node.js entry-point doc
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/source/javascript.md Adds common-pattern link to Node.js entry-point doc
plugin/skills/azure-prepare/references/services/functions/templates/recipes/composition.md Adds “critical” warnings for Node.js and .NET entry points in composition step
plugin/skills/azure-prepare/references/services/functions/templates/recipes/common/nodejs-entry-point.md New shared Node.js entry-point documentation
plugin/skills/azure-prepare/references/services/functions/templates/recipes/common/dotnet-entry-point.md New shared .NET entry-point documentation
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/source/typescript.md Adds common-pattern link to Node.js entry-point doc
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/source/javascript.md Adds common-pattern link to Node.js entry-point doc

paulyuk and others added 2 commits February 20, 2026 16:13
Strengthen warning on Consumption Plan (Y1) section in bicep.md
to match the terraform.md warning pattern.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…warnings

PROBLEM:
- composition.md referenced Terraform templates that don't exist (-tf variants)
- When user requests Terraform, agent would synthesize from scratch
- Y1 legacy examples could be mistakenly used for new deployments

FIX:
- Remove non-existent Terraform template references
- Add explicit guidance to use Bicep templates and convert
- Add ⛔ DO NOT USE warnings on Y1/Dynamic SKU examples
- Make FC1 (Flex Consumption) the only option for new deployments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 21, 2026 00:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • tests/package-lock.json: Language not supported

paulyuk and others added 2 commits February 20, 2026 16:20
- dotnet has official Terraform template: functions-quickstart-dotnet-azd-tf
- Other languages: reference flex-consumption-samples TF as fallback
- Removed inefficient 'convert Bicep to TF' approach

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Terraform IaC is identical across languages - only runtime name and
version differ. Use functions-quickstart-dotnet-azd-tf for ALL languages
and modify the runtime variables.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 21, 2026 00:23
Replace hardcoded version numbers with guidance to query official docs:
https://learn.microsoft.com/en-us/azure/azure-functions/supported-languages

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • tests/package-lock.json: Language not supported

Fixes:
1. nodejs-entry-point.md: Fixed package.json main field - use single entry
   point, not glob patterns. Runtime auto-discovers functions/*.js
2. eval.yaml: Made nodejs_entry_point grader informational with skip_if_no_match
   so it doesn't fail C#/Python tasks
3. timer/dotnet.md: Changed 'Replace contents' to 'Add trigger file'
4. servicebus/dotnet.md: Changed 'Replace contents' to 'Add trigger file'
5. durable/dotnet.md: Changed 'Replace contents' to 'Add trigger file'

All changes resolve contradictions between 'do not modify Program.cs'
and 'replace contents' instructions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
saikoumudi
saikoumudi previously approved these changes Feb 21, 2026
Key learnings from URL shortener E2E test with Terraform + Node.js:

- package.json MUST be at project ROOT, not inside src/
- azure.yaml must use 'project: .' not 'project: ./src/'
- Source code is IDENTICAL for Bicep and Terraform (only infra/ differs)
- Both glob pattern and simple entry point work for function discovery
- Added explicit project structure diagrams and azure.yaml examples
- Enhanced Common Mistakes table with project structure errors

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 21, 2026 00:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • tests/package-lock.json: Language not supported

paulyuk and others added 2 commits February 20, 2026 17:16
E2E testing revealed that 'main: src/index.js' does NOT work.
The glob pattern 'src/{index.js,functions/*.js}' is REQUIRED for
the Azure Functions runtime to discover functions in src/functions/.

Changes:
- Remove 'simple entry point' option that doesn't work
- Add ⛔ CRITICAL warnings about glob requirement
- Update Common Mistakes table with microsoft#1 cause of 404
- Add glob requirement to composition.md Step 5
- Update TypeScript pattern to use glob too

This was the root cause of both E2E test failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
E2E testing revealed repeated failures due to:
1. 403 Forbidden - RBAC not propagated (Azure AD takes 30-60s)
2. 404 Container Not Found - deployment container not created
3. Tag Not Found - Azure resource tags take time to be queryable

Added solutions:
- time_sleep resource pattern for RBAC delays
- Explicit deployment container creation
- Warning callout with common failure modes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 21, 2026 01:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • tests/package-lock.json: Language not supported

Copy link
Member Author

@paulyuk paulyuk left a comment

Choose a reason for hiding this comment

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

Code reviewed

1. README.md: Update Terraform templates to match composition.md
   - All non-.NET languages use functions-quickstart-dotnet-azd-tf
   - Add note explaining runtime configuration approach

2. composition.md: Clarify azurerm vs azapi resource usage
   - azurerm_linux_function_app for Standard/Premium plans
   - azapi_resource REQUIRED for Flex Consumption (FC1)
   - Added complete FC1 example with functionAppConfig

Resolves PR comments:
- r2835661181: Terraform template inconsistency
- r2835661188: azurerm vs azapi resource type

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@paulyuk paulyuk requested a review from saikoumudi February 21, 2026 02:01
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.

[Skill Bug]: Node.js Azure Functions fail to deploy

2 participants