Skip to content

Instantly share code, notes, and snippets.

@cocodrino
Created January 5, 2020 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocodrino/a8e8703b8caa99e6689bb2ef3e847581 to your computer and use it in GitHub Desktop.
Save cocodrino/a8e8703b8caa99e6689bb2ef3e847581 to your computer and use it in GitHub Desktop.
remote debug
si se desea activar de manera segura el debugger de node se debe seguir los siguientes pasos
1. corra el script con el argumento inspect-brk
```
pm2 start ./server/server.js --node-args="--inspect-brk" --name api-test
```
luego, *NO* abra puertos, esto es inseguro y cualquiera con acceso a su ip y puerto tendría acceso al código, para conectar la máquina local lo mejor es usar un ssh tunneling
https://nodejs.org/en/docs/guides/debugging-getting-started/#enabling-remote-debugging-scenarios
```
ssh -L 9221:localhost:9229 -i tests.pem root@ip
```
ahora simplemente activa el debugger en su máquina escuchando localhost y el puerto 9221
**UNA VEZ TERMINE DE HACER DEBBUG REINICIE EL PROCESO SIN EL DEBBUGER, NO LO DEJE ACTIVO**
:sunglasses:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment