Skip to content

Fix deployment to stopped Function Apps with clear error message #4664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 13, 2025

When deploying to a stopped Function App, users were getting a confusing system error message instead of a clear indication of what was wrong:

Before:

Error: Serialization and deserialization of 'System.Reflection.MethodBase' instances is not supported

After:

Cannot deploy to function app "my-app" because it is currently stopped. Please start the function app before deploying.

Changes Made

  • Added a state check in src/commands/deploy/deploy.ts that verifies the Function App is not in a STOPPED state before proceeding with deployment
  • The check occurs early in the deployment process, right after site initialization, to fail fast with a helpful message
  • Added proper error handling flags to suppress the misleading system error that was previously displayed
  • Included appropriate telemetry tracking for stopped app deployment attempts

Implementation Details

The fix checks site.rawSite.state === 'STOPPED' and throws a localized error message. This approach:

  • Only blocks deployments to explicitly stopped Function Apps
  • Allows deployments to proceed for READY and UNKNOWN states (maintaining existing behavior)
  • Provides clear, actionable guidance to users
  • Follows the existing error handling patterns in the codebase

Testing

Added comprehensive unit tests covering all three possible site states (STOPPED, READY, UNKNOWN) to ensure the fix works correctly and doesn't break existing functionality.

Fixes #4662.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: gulp preTest (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Contributor Author

Copilot AI commented Aug 13, 2025

@alexweininger 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

@Copilot Copilot AI changed the title [WIP] Deployment to stopped Function App fails with misleading error: 'System.Reflection.MethodBase' instances not supported Fix deployment to stopped Function Apps with clear error message Aug 13, 2025
@Copilot Copilot AI requested a review from alexweininger August 13, 2025 18:31
Copilot finished work on behalf of alexweininger August 13, 2025 18:31
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.

Deployment to stopped Function App fails with misleading error: 'System.Reflection.MethodBase' instances not supported
2 participants