When I was doing the Azure tutorial "[Deploy Azure Functions from Visual Studio Code] [* 1]" An error occurred when executing the function locally. Since it depends on the version of Node, the function is executed locally on Docker. It took a long time to check the debug execution settings, so I will leave it as a memorandum.
Windows 10 Home
chocolatey 0.10.15
Vagrant 2.2.10
virtualbox 6.1.16
Ubuntu 20.04 LTS
Docker version 19.03.13, build 4484c46d9d
docker-compose version 1.27.4, build 40524192
Vagrant is launched with an IP of 192.168.50.10.
choco install azure-functions-core-tools-3 --params "'/x64'" -y
docker/functions/Dockerfile
# docker-Get container with node from hub
# https://hub.docker.com/_/node/
FROM node:12.19.0
WORKDIR /app
#Tool installation
RUN npm i -g azure-functions-core-tools@3 --unsafe-perm true
#Install Functions
COPY ./package.json /app/package.json
RUN npm install
docker/docker-compose.yml
version: "3.8"
services:
az-functions:
build: ./functions
volumes:
- ../HttpExample:/app/HttpExample
- ../tsconfig.json:/app/tsconfig.json
- ../local.settings.json:/app/local.settings.json
ports:
- 9229:9229
- 7071:7071
working_dir: /app
command: [npm, run, start]
docker-compose up
command in the docker
directory to confirm that functions are launched.When debugging from vscode, I couldn't do it exactly as it was created in Creating a project.
json:.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Vagrant - Docker: Attach to Node Functions",
"type": "node",
"request": "attach",
"remoteRoot": "/app",
"address": "192.168.50.10",
"port": 9229,
"protocol": "auto",
}
]
}
fails unless it runs on
0.0.0.0`.json:local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "node",
"languageWorkers:node:arguments": "--inspect=0.0.0.0:9229"
}
}
docker-compose up
[Docker + Node.js Debugging Visual Studio Code] [* 5] [Deploy Azure Functions from Visual Studio Code] [* 1] [Functions Local Debugging] [* 2] Azure Functions Core Tools node debug guide [When https in source list cannot be obtained in Debian] [* 4] lsb_release: command not found in latest Ubuntu Docker container [Debug Node.js application with Visual Studio Code (local process attach / remote debug)] [* 6] How to set inspect port for nodejs [Developable debugable node.js application starting with Visual Studio Code (tutorial up to hello world with express + ejs)] [* 8]
Recommended Posts