vscode launching function app in lerna monorepo
First, I have a monorepo that is structured like so:
repo-name/
packages/
backend/
frontend/
.vscode/
The backend is an Azure function app structured like so:
backend/
functions/
funcOne/
funcTwo/
scripts/
start-debug.sh
package.json
Second, for the backend
's package.json
, I have a script:
"debug": "npm run build && FUNCTION_APP_PORT=7071 ./scripts/start-debug.sh",
The start-debug.sh
script looks like this:
#!/bin/bash
set -e
cd ./functions
func extensions install
func host start -p $FUNCTION_APP_PORT --debug VSCode
I'm trying to write a launch configuration so that I can debug my functions in VSCode.
I have tried a number of variations based on what I have found out there, but nothing seems to work. Does anyone have any suggestions?
Here's my latest attempt:
{
"name": "Launch Backend Functions",
"type": "node",
"request": "launch",
"address": "localhost",
"protocol": "inspector",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/lerna",
"runtimeArgs": [
"exec",
"--scope",
"actual-name-of-backend-package",
"--",
"npm"
],
"args": ["run", "debug"],
"port": 1234
}
azure visual-studio-code vscode-debugger lerna monorepo
add a comment |
First, I have a monorepo that is structured like so:
repo-name/
packages/
backend/
frontend/
.vscode/
The backend is an Azure function app structured like so:
backend/
functions/
funcOne/
funcTwo/
scripts/
start-debug.sh
package.json
Second, for the backend
's package.json
, I have a script:
"debug": "npm run build && FUNCTION_APP_PORT=7071 ./scripts/start-debug.sh",
The start-debug.sh
script looks like this:
#!/bin/bash
set -e
cd ./functions
func extensions install
func host start -p $FUNCTION_APP_PORT --debug VSCode
I'm trying to write a launch configuration so that I can debug my functions in VSCode.
I have tried a number of variations based on what I have found out there, but nothing seems to work. Does anyone have any suggestions?
Here's my latest attempt:
{
"name": "Launch Backend Functions",
"type": "node",
"request": "launch",
"address": "localhost",
"protocol": "inspector",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/lerna",
"runtimeArgs": [
"exec",
"--scope",
"actual-name-of-backend-package",
"--",
"npm"
],
"args": ["run", "debug"],
"port": 1234
}
azure visual-studio-code vscode-debugger lerna monorepo
Hey I've written a small vscode extension that can help you differentiate easily when you're working on a serverside file and a clientside file based on regex and colors. Maybe helpful to you! marketplace.visualstudio.com/…
– orepor
Jan 25 at 12:48
add a comment |
First, I have a monorepo that is structured like so:
repo-name/
packages/
backend/
frontend/
.vscode/
The backend is an Azure function app structured like so:
backend/
functions/
funcOne/
funcTwo/
scripts/
start-debug.sh
package.json
Second, for the backend
's package.json
, I have a script:
"debug": "npm run build && FUNCTION_APP_PORT=7071 ./scripts/start-debug.sh",
The start-debug.sh
script looks like this:
#!/bin/bash
set -e
cd ./functions
func extensions install
func host start -p $FUNCTION_APP_PORT --debug VSCode
I'm trying to write a launch configuration so that I can debug my functions in VSCode.
I have tried a number of variations based on what I have found out there, but nothing seems to work. Does anyone have any suggestions?
Here's my latest attempt:
{
"name": "Launch Backend Functions",
"type": "node",
"request": "launch",
"address": "localhost",
"protocol": "inspector",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/lerna",
"runtimeArgs": [
"exec",
"--scope",
"actual-name-of-backend-package",
"--",
"npm"
],
"args": ["run", "debug"],
"port": 1234
}
azure visual-studio-code vscode-debugger lerna monorepo
First, I have a monorepo that is structured like so:
repo-name/
packages/
backend/
frontend/
.vscode/
The backend is an Azure function app structured like so:
backend/
functions/
funcOne/
funcTwo/
scripts/
start-debug.sh
package.json
Second, for the backend
's package.json
, I have a script:
"debug": "npm run build && FUNCTION_APP_PORT=7071 ./scripts/start-debug.sh",
The start-debug.sh
script looks like this:
#!/bin/bash
set -e
cd ./functions
func extensions install
func host start -p $FUNCTION_APP_PORT --debug VSCode
I'm trying to write a launch configuration so that I can debug my functions in VSCode.
I have tried a number of variations based on what I have found out there, but nothing seems to work. Does anyone have any suggestions?
Here's my latest attempt:
{
"name": "Launch Backend Functions",
"type": "node",
"request": "launch",
"address": "localhost",
"protocol": "inspector",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/lerna",
"runtimeArgs": [
"exec",
"--scope",
"actual-name-of-backend-package",
"--",
"npm"
],
"args": ["run", "debug"],
"port": 1234
}
azure visual-studio-code vscode-debugger lerna monorepo
azure visual-studio-code vscode-debugger lerna monorepo
edited Nov 20 '18 at 21:05
westandy
asked Nov 20 '18 at 20:49
westandywestandy
4691720
4691720
Hey I've written a small vscode extension that can help you differentiate easily when you're working on a serverside file and a clientside file based on regex and colors. Maybe helpful to you! marketplace.visualstudio.com/…
– orepor
Jan 25 at 12:48
add a comment |
Hey I've written a small vscode extension that can help you differentiate easily when you're working on a serverside file and a clientside file based on regex and colors. Maybe helpful to you! marketplace.visualstudio.com/…
– orepor
Jan 25 at 12:48
Hey I've written a small vscode extension that can help you differentiate easily when you're working on a serverside file and a clientside file based on regex and colors. Maybe helpful to you! marketplace.visualstudio.com/…
– orepor
Jan 25 at 12:48
Hey I've written a small vscode extension that can help you differentiate easily when you're working on a serverside file and a clientside file based on regex and colors. Maybe helpful to you! marketplace.visualstudio.com/…
– orepor
Jan 25 at 12:48
add a comment |
1 Answer
1
active
oldest
votes
OK, here's the launch configuration in VSCode that worked for me:
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"protocol": "legacy",
"processId": "${command:PickProcess}",
"port": 9229
},
My steps are
1) Go to my backend
repo, and run npm run debug
which runs my start-debug.sh
script.
2) In VS Code, I attach to a nodejsWorker
out of azure-function-core-tools
.
Now, I can step through my functions.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401298%2fvscode-launching-function-app-in-lerna-monorepo%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
OK, here's the launch configuration in VSCode that worked for me:
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"protocol": "legacy",
"processId": "${command:PickProcess}",
"port": 9229
},
My steps are
1) Go to my backend
repo, and run npm run debug
which runs my start-debug.sh
script.
2) In VS Code, I attach to a nodejsWorker
out of azure-function-core-tools
.
Now, I can step through my functions.
add a comment |
OK, here's the launch configuration in VSCode that worked for me:
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"protocol": "legacy",
"processId": "${command:PickProcess}",
"port": 9229
},
My steps are
1) Go to my backend
repo, and run npm run debug
which runs my start-debug.sh
script.
2) In VS Code, I attach to a nodejsWorker
out of azure-function-core-tools
.
Now, I can step through my functions.
add a comment |
OK, here's the launch configuration in VSCode that worked for me:
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"protocol": "legacy",
"processId": "${command:PickProcess}",
"port": 9229
},
My steps are
1) Go to my backend
repo, and run npm run debug
which runs my start-debug.sh
script.
2) In VS Code, I attach to a nodejsWorker
out of azure-function-core-tools
.
Now, I can step through my functions.
OK, here's the launch configuration in VSCode that worked for me:
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"protocol": "legacy",
"processId": "${command:PickProcess}",
"port": 9229
},
My steps are
1) Go to my backend
repo, and run npm run debug
which runs my start-debug.sh
script.
2) In VS Code, I attach to a nodejsWorker
out of azure-function-core-tools
.
Now, I can step through my functions.
answered Nov 20 '18 at 21:04
westandywestandy
4691720
4691720
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401298%2fvscode-launching-function-app-in-lerna-monorepo%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Hey I've written a small vscode extension that can help you differentiate easily when you're working on a serverside file and a clientside file based on regex and colors. Maybe helpful to you! marketplace.visualstudio.com/…
– orepor
Jan 25 at 12:48