Skip to content

fix: 🤖 attempt fix for issue #571#572

Open
github-actions[bot] wants to merge 2 commits intomainfrom
ai-fix/issue-571
Open

fix: 🤖 attempt fix for issue #571#572
github-actions[bot] wants to merge 2 commits intomainfrom
ai-fix/issue-571

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Automated fix attempt

Fixes #571

Source issue: #571

Summary

Summary

Changes made to mcp/src/tools/functions.ts:

  1. Updated handler description in CREATE_FUNCTION_SCHEMA (line ~270-277): The handler field description now explicitly distinguishes between Event and HTTP functions. It tells agents that Event functions use file.export format (e.g., index.main), while HTTP functions do not need a handler because entry is determined by scf_bootstrap. Setting handler for HTTP functions can cause startup conflicts.

  2. Updated handler description in the manage function input schema (the outer handler parameter): Same explicit guidance — Event functions use file.export format; HTTP functions don't need handler and should not set it.

  3. Added fail-fast validation (line ~906-913): When func.type === "HTTP" and func.handler contains a dot (i.e., Event-style file.export format like index.main), the tool now throws an error immediately before the deployment proceeds. The error message explains that HTTP functions use scf_bootstrap to listen on a port, don't need a file.export handler, and the agent should remove the func.handler field and ensure the function directory contains scf_bootstrap and a port-listening entry script.

Changes made to mcp/src/tools/functions.test.ts:

Added three regression tests:

  • "rejects Event-style handler for HTTP functions": Verifies that creating an HTTP function with handler: "index.main" returns success: false, includes the handler value and scf_bootstrap in the error message, and never calls createFunction.
  • "allows HTTP functions without handler": Verifies that HTTP functions without a handler succeed normally.
  • "allows Event functions with handler": Verifies that Event functions with handler: "index.main" still work (no regression).

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.

manageFunctions should fail fast on HTTP function handler/bootstrap ambiguity

1 participant