microsoft / microsoft/vscode-azurefunctions
Can't use two func host start tasks in the same workspace
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 319
- Forks
- 158
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 4
Description
Hi team,
I'm trying to hack my way around running my function app locally with different set of environment variables (i.e. different local.settings.json files)
To make to process a bit less hands-on, I've added another launch a task to my workspace that follows this logic:
- npm run install
- npm run build
- Merge two json files into local.settings.json using a bash script
- func host start
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Azure Node Functions",
"type": "node",
"request": "attach",
"port": 9229,
"preLaunchTask": "func: host start"
},
{
"name": "Migration Tests (Foo)",
"type": "node",
"request": "attach",
"port": 9229,
"preLaunchTask": "run migration task"
},
]
}
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "func",
"label": "func: host start",
"command": "host start",
"problemMatcher": "$func-node-watch",
"isBackground": true,
"dependsOn": "npm build (functions)"
},
{
"type": "shell",
"label": "npm build (functions)",
"command": "npm run build",
"dependsOn": "npm install (functions)",
"problemMatcher": "$tsc"
},
{
"type": "shell",
"label": "npm install (functions)",
"command": "npm install"
},
{
"type": "shell",
"label": "npm prune (functions)",
"command": "npm prune --production",
"dependsOn": "npm build (functions)",
"problemMatcher": []
},
{
"type": "shell",
"label": "Merge Migration Settings task",
"command": "${workspaceFolder}/generate-local-settings-file.sh",
"args": [
"${workspaceFolder}/tests/migrations/${input:testType}.json",
"${workspaceFolder}/local.settings.json"
],
"dependsOn": "npm build (functions)"
},
{
"type": "func",
"label": "run migration task",
"command": "host start",
"problemMatcher": "$func-node-watch",
"isBackground": true,
"dependsOn": "Merge Migration Settings task",
},
],
"inputs": [
{
"type": "pickString",
"id": "testType",
"description": "What type of test do you want to run?",
"options": [
"exclude-migration",
"include-migration",
],
"default": "include-migration"
}
]
}
I noticed that once I've set up my tasks the way they are in the example above - I can't use Debug Azure Node Functions anymore, and I'm getting the error: Could not find the task 'func: host start'.
Now, if I switch the order of run migration task with func: host start, then Migration Tests (Foo) stops working, and Debug Azure Node Functions works.
What are the odds that when vscode looks up func type tasks, it takes / checks only the last entry instead of the whole array?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the shown launch.json and tasks.json, using the two func-type tasks and their preLaunchTask labels. Then trace how the Azure Functions extension resolves func tasks; done means both Debug Azure Node Functions and Migration Tests (Foo) can find and start their respective tasks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, typescript, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100