Skip to content
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

The vs code task "Start API and Web" does not work any more #2852

Closed
1 task done
thomasofdenmark opened this issue Oct 10, 2023 · 12 comments · Fixed by #2858
Closed
1 task done

The vs code task "Start API and Web" does not work any more #2852

thomasofdenmark opened this issue Oct 10, 2023 · 12 comments · Fixed by #2858
Assignees
Labels
customer-reported identify a customer issue question vscode Visual Studio Code

Comments

@thomasofdenmark
Copy link

Output from azd version
Run azd version and copy and paste the output here:
azd version 1.4.1 (commit 1cbed85)

Describe the bug
I am trying to run the task "Start API and Web" using the todo-nodejs-mongo-aks template. When I do "Shift + cmd + p" -> Tasks: Run task, I get this error in the OUTPUT tab (before selecting the actual task)

Error: the task 'Workspace: Restore API' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,azd restore api,",
    "idRandomizer": 0.39070389774816827,
    "problemMatcher": [],
    "label": "Workspace: Restore API"
}
Error: the task 'Workspace: Restore Web' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,azd restore web,",
    "idRandomizer": 0.7531014802740759,
    "problemMatcher": [],
    "label": "Workspace: Restore Web"
}
Error: the task 'Workspace: Web npm start' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,npm run start,",
    "idRandomizer": 0.3778032979344932,
    "problemMatcher": [],
    "label": "Workspace: Web npm start",
    "detail": "Helper task--use 'Start Web' task to ensure environment is set up correctly"
}
Error: the task 'Workspace: API npm start' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,npm run start,",
    "idRandomizer": 0.9120319229664988,
    "problemMatcher": [],
    "label": "Workspace: API npm start",
    "detail": "Helper task--use 'Start API' task to ensure environment is set up correctly"
}
Error: the task 'Workspace: Restore Web' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,azd restore web,",
    "idRandomizer": 0.6341149130277672,
    "problemMatcher": [],
    "label": "Workspace: Restore Web"
}
Error: the task 'Workspace: Web npm start' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,npm run start,",
    "idRandomizer": 0.18705709546311455,
    "problemMatcher": [],
    "label": "Workspace: Web npm start",
    "detail": "Helper task--use 'Start Web' task to ensure environment is set up correctly"
}
Error: the task 'Workspace: Restore Web' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,azd restore web,",
    "idRandomizer": 0.36323288159932354,
    "problemMatcher": [],
    "label": "Workspace: Restore Web"
}
Error: the task 'Workspace: Web npm start' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,npm run start,",
    "idRandomizer": 0.9128663822720793,
    "problemMatcher": [],
    "label": "Workspace: Web npm start",
    "detail": "Helper task--use 'Start Web' task to ensure environment is set up correctly"
}
Error: the task 'Workspace: Restore API' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,azd restore api,",
    "idRandomizer": 0.8271939443913685,
    "problemMatcher": [],
    "label": "Workspace: Restore API"
}
Error: the task 'Workspace: Restore Web' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,azd restore web,",
    "idRandomizer": 0.699224959049467,
    "problemMatcher": [],
    "label": "Workspace: Restore Web"
}
Error: the task 'Workspace: Web npm start' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,npm run start,",
    "idRandomizer": 0.47869063647859744,
    "problemMatcher": [],
    "label": "Workspace: Web npm start",
    "detail": "Helper task--use 'Start Web' task to ensure environment is set up correctly"
}
Error: the task 'Workspace: API npm start' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,npm run start,",
    "idRandomizer": 0.6953999379453406,
    "problemMatcher": [],
    "label": "Workspace: API npm start",
    "detail": "Helper task--use 'Start API' task to ensure environment is set up correctly"
}
Error: the task 'Workspace: Restore API' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,azd restore api,",
    "idRandomizer": 0.8867094619014328,
    "problemMatcher": [],
    "label": "Workspace: Restore API"
}
Error: the task 'Workspace: Restore Web' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,azd restore web,",
    "idRandomizer": 0.7523203600364023,
    "problemMatcher": [],
    "label": "Workspace: Restore Web"
}
Error: the task 'Workspace: Web npm start' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,npm run start,",
    "idRandomizer": 0.3410895416577724,
    "problemMatcher": [],
    "label": "Workspace: Web npm start",
    "detail": "Helper task--use 'Start Web' task to ensure environment is set up correctly"
}
Error: the task 'Workspace: API npm start' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
    "type": "shell",
    "id": "shell,npm run start,",
    "idRandomizer": 0.7469761562245649,
    "problemMatcher": [],
    "label": "Workspace: API npm start",
    "detail": "Helper task--use 'Start API' task to ensure environment is set up correctly"
}

This is my tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Start Web",
            "type": "dotenv",
            "targetTasks": [
                "Restore Web",
                "Web npm start"
            ],
            "file": "${input:dotEnvFilePath}"
        },
        {
            "label": "Restore Web",
            "type": "shell",
            "command": "azd restore web",
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": []
        },
        {
            "label": "Web npm start",
            "detail": "Helper task--use 'Start Web' task to ensure environment is set up correctly",
            "type": "shell",
            "command": "npm run start",
            "options": {
                "cwd": "${workspaceFolder}/src/web/",
                "env": {
                    "WEB_APP_API_BASE_URL": "http://localhost:3100",
                    "BROWSER": "none"
                }
            },
            "presentation": {
                "panel": "dedicated",
            },
            "problemMatcher": []
        },

        {
            "label": "Start API",
            "type": "dotenv",
            "targetTasks": [
                "Restore API",
                "API npm start"
            ],
            "file": "${input:dotEnvFilePath}"
        },
        {
            "label": "Restore API",
            "type": "shell",
            "command": "azd restore api",
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": []
        },
        {
            "label": "API npm start",
            "detail": "Helper task--use 'Start API' task to ensure environment is set up correctly",
            "type": "shell",
            "command": "npm run start",
            "options": {
                "cwd": "${workspaceFolder}/src/api/",
                "env": {
                    "NODE_ENV": "development"
                }
            },
            "presentation": {
                "panel": "dedicated",
            },
            "problemMatcher": []
        },

        {
            "label": "Start API and Web",
            "dependsOn":[
                "Start API",
                "Start Web"
            ],
            "problemMatcher": []
        }
    ],

    "inputs": [
        {
            "id": "dotEnvFilePath",
            "type": "command",
            "command": "azure-dev.commands.getDotEnvFilePath"
        }
    ]
}
@rajeshkamal5050
Copy link

@bwateratmsft @vhvb1989 can you take a look?

@rajeshkamal5050 rajeshkamal5050 added the vscode Visual Studio Code label Oct 10, 2023
@vhvb1989
Copy link
Member

@thomasofdenmark , can you confirm if you have the AzureDeveloperCLI - VSCode extension installed? (and also what version it is)

Something like:

image

@bwateratmsft
Copy link
Contributor

@thomasofdenmark Those errors in the Output window are a known VSCode bug and you can ignore them.

@thomasofdenmark
Copy link
Author

@vhvb1989 Yes it is installed. I have version 0.7.0.

@thomasofdenmark
Copy link
Author

thomasofdenmark commented Oct 10, 2023

It seems like it is the "Start API" and "Start Web" tasks that is doing nothing. The other ones starts up in the TERMINAL tab if I run the individually.

@bwateratmsft
Copy link
Contributor

Does F5 (or the command "Debug: Start Debugging") work? The tasks are meant to be consumed by VSCode to enable debugging.

@thomasofdenmark
Copy link
Author

Does F5 (or the command "Debug: Start Debugging") work? The tasks are meant to be consumed by VSCode to enable debugging.

No, that does not work either.

@thomasofdenmark
Copy link
Author

This seem to be the same issue. When I replace "${input:dotEnvFilePath}" with "${workspaceFolder}/.azure/your-azure-env-name/.env" it works. So mabye the issue is with the "command" in the tasks.json:

"inputs": [
        {
            "id": "dotEnvFilePath",
            "type": "command",
            "command": "azure-dev.commands.getDotEnvFilePath"
        }
    ]

@bwateratmsft
Copy link
Contributor

Good find, I'll take a look.

@bwateratmsft
Copy link
Contributor

This looks to be a regression in the Azure Dev CLI itself. Compare the output from 1.3.1 vs 1.4.1:

1.3.1: azd env list --output json

[
  {
    "Name": "bwatertestenv",
    "IsDefault": true,
    "DotEnvPath": "D:\\Sandbox\\AzdTaskTest\\.azure\\bwatertestenv\\.env"
  }
]

1.4.1: azd env list --output json

[
  {
    "Name": "bwatertestenv",
    "HasLocal": true,
    "HasRemote": false,
    "IsDefault": true
  }
]

The 1.4.1 output is missing DotEnvFilePath, which was present in 1.3.1. This is exactly what is being returned by the command--so the command is now returning undefined, which I guess VSCode takes to mean aborting the run of the task.

@wbreza do you know about the removal of that property?

@wbreza
Copy link
Contributor

wbreza commented Oct 11, 2023

@wbreza do you know about the removal of that property?

@bwateratmsft This was unintentionally removed. Posted PR #2858 with a fix.

@pamelafox
Copy link
Member

I got the error again today when opening https://github.com/Azure-Samples/azure-search-openai-demo/

Error: there is no registered task type 'dotenv'. Did you miss installing an extension that provides a corresponding task provider?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported identify a customer issue question vscode Visual Studio Code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants