0.2.44 • Published 3 years ago

sandbox-debugger v0.2.44

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
3 years ago

sandbox-debugger

js-standard-style ci automerge Docker Image CI downloads Docker Pulls

Debug a Node.js process anywhere using chrome://inspect or node-inspect

node debug port 9229sandbox debug clientsandbox debug broker

Interactive debugging using inspect, debug the same way you do with a local process.

Supports a Node.js process running

How it works?

Node opens a websocket when in debug mode, both the sandbox server and client work by piping the websocket data via the broker.

Run sandbox server

The server is used as a gatekeeper for the debug messages.

npx sandbox-debugger-server

or

ᐅ docker run \
  --name sandbox-debugger \
  -ti \
  --rm \
  -p 9229:9229 \
  jameskyburz/sandbox-debugger

The server will output

   Debug server started!                       
                                               
    - To debug a new process:                  
      export DEBUG_PROXY=xxx.xxx.x.xxx:9229    
      node index.js                            
                                               
    - To debug an existing process:            
      export DEBUG_PROXY=xxx.xxx.x.xxx:9229    
      export DEBUG_PID=<pid of node process>   
      npx sandbox-debugger                     

    - Find pid of first running Node.js process
      ps ax |
      grep 'no[d]e ' |
      awk '{print $1}' |
      head -n 1
                                               
    - Allow remote access to me:              
      npx ngrok http 9229                      

Create a tunnel to our sandbox server process

Using ngrok you can tunnel to the locally running broker from for example aws lambda.

npx ngrok http 9229

Client

Example debug current process

// index.js
require('sandbox-debugger')
debugger
console.log('all done')

# DEBUG_PROXY is ip:port to sandbox broker
DEBUG_PROXY=ip:port node index.js

Example debug an already running process

# DEBUG_PROXY is ip:port to sandbox broker
# DEBUG_PID is pid of process to debug
DEBUG_PROXY=ip:port DEBUG_PID=x npx sandbox-debugger

AWS Lambda

Environment variable DEBUG_PROXY needs to point to the ngrok address including the port part :80.

The easiest way to debug lambda is to edit the code in aws console.

  • Copy the contents of https://unpkg.com/sandbox-debugger@latest/dist/index.js to debug.js
  • require('./debug.js') instead of sandbox-debugger

or

Use a lambda layer containing the sandbox-debugger, you can publish your own for node 12 here and also node 10 here.

license

Apache License, Version 2.0

0.2.44

3 years ago

0.2.43

3 years ago

0.2.42

3 years ago

0.2.41

3 years ago

0.2.40

3 years ago

0.2.39

3 years ago

0.2.38

4 years ago

0.2.37

4 years ago

0.2.36

4 years ago

0.2.35

4 years ago

0.2.34

4 years ago

0.2.33

4 years ago

0.2.31

4 years ago

0.2.24

4 years ago

0.2.23

4 years ago

0.2.22

4 years ago

0.2.20

4 years ago

0.2.30

4 years ago

0.2.19

4 years ago

0.2.16

4 years ago

0.2.15

4 years ago

0.2.14

4 years ago

0.2.13

4 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.7

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.35

5 years ago

0.1.33

5 years ago

0.1.23

5 years ago

0.1.21

5 years ago

0.1.18

5 years ago

0.1.17

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago