Skip to content

Ensure wwwroot directory exists on new slot and app creation w/ networking restrictions#11757

Open
satvu wants to merge 3 commits intodevfrom
satvu/ensure-wwwroot-exists
Open

Ensure wwwroot directory exists on new slot and app creation w/ networking restrictions#11757
satvu wants to merge 3 commits intodevfrom
satvu/ensure-wwwroot-exists

Conversation

@satvu
Copy link
Copy Markdown
Member

@satvu satvu commented Apr 29, 2026

Issue describing the changes in this PR

resolves #11654

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

@satvu satvu changed the title initial Ensure wwwroot directory exists on new slot and app creation Apr 29, 2026
@satvu satvu marked this pull request as ready for review April 29, 2026 23:57
@satvu satvu requested a review from a team as a code owner April 29, 2026 23:57
Copilot AI review requested due to automatic review settings April 29, 2026 23:57
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Ensures the worker process working directory is created when missing (e.g., new deployment slots/apps) and adds a unit test to cover the behavior.

Changes:

  • Create the worker process working directory on demand before building the ProcessStartInfo.
  • Add a unit test validating the working directory is created and applied to the worker ProcessStartInfo.

Reviewed changes

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

File Description
test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs Adds a unit test validating missing working directories are created and used.
src/WebJobs.Script.Grpc/ProcessManagement/DefaultWorkerProcessFactory.cs Creates the working directory if it doesn’t exist before creating the worker process.

Comment thread test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs Outdated
Comment thread test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs Outdated
}
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to create working directory '{workingDirectory}'. The worker process may fail to start.", context.WorkingDirectory);
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

If directory creation fails, the method continues and will likely fail later when starting the process with a non-existent WorkingDirectory, producing a less actionable error. Consider failing fast by rethrowing (or throwing a dedicated exception), or explicitly clearing/falling back the working directory when creation fails so the process can still start deterministically.

Suggested change
_logger.LogWarning(ex, "Failed to create working directory '{workingDirectory}'. The worker process may fail to start.", context.WorkingDirectory);
_logger.LogWarning(ex, "Failed to create working directory '{workingDirectory}'.", context.WorkingDirectory);
throw new InvalidOperationException($"Failed to create working directory '{context.WorkingDirectory}' for the worker process.", ex);

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think the current failure behavior (diagnostic error saying no directory is found) is sufficient and this log adds more information upon investigation.

@satvu satvu changed the title Ensure wwwroot directory exists on new slot and app creation Ensure wwwroot directory exists on new slot and app creation w/ networking restrictions Apr 30, 2026
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.

New slot creation OR network restrictions can throw error where no wwwroot is found

3 participants