npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sandbox-debugger-server

v0.2.45

Published

sandbox debugger server broker for node

Downloads

228

Readme

🐛 sandbox-debugger 🐛

js-standard-style

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

| node debug port 9229 | ⟷ | sandbox debug client | ⟷ | sandbox 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 --scheme http

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 --scheme http

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, and require('./debug.cjs') instead of sandbox-debugger

ESM example

  import { createRequire } from 'node:module'
  const require = createRequire(import.meta.url)
  require('./debug.cjs')

license

Apache License, Version 2.0