Skip to content

Wrong tasks.json is being used during F5 from an azd initialization #32

@ggailey777

Description

@ggailey777

This issue is related to #21.

Problem:

The root tasks.json only defines the func: host start task, but is missing the pip install (functions) and func: extensions install tasks that it depends on. These tasks exist in tasks.json in the /src folder, but that file is not used when the workspace root is the repo root (which is the default when cloning).

This means pressing F5 fails because:

The dependsOn tasks (pip install, extensions install) referenced in tasks.json in /src are not found, even though the root tasks.json has "cwd": "${workspaceFolder}/src", it has no dependency chain to install requirements first

Fix:

The root tasks.json should include all three tasks with "cwd": "${workspaceFolder}/src":

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "pip install (functions)",
      "type": "shell",
      "osx": { "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt" },
      "windows": { "command": "${config:azureFunctions.pythonVenv}\\Scripts\\python -m pip install -r requirements.txt" },
      "linux": { "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt" },
      "options": { "cwd": "${workspaceFolder}/src" },
      "problemMatcher": []
    },
    {
      "type": "func",
      "label": "func: host start",
      "command": "host start",
      "problemMatcher": "$func-python-watch",
      "isBackground": true,
      "options": { "cwd": "${workspaceFolder}/src" },
      "dependsOn": "func: extensions install"
    },
    {
      "type": "func",
      "command": "extensions install",
      "dependsOn": "pip install (functions)",
      "options": { "cwd": "${workspaceFolder}/src" },
      "problemMatcher": []
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions