I'm currently building a node.js chatbot which I then deploy on heroku. The app uses webhooks which must be at a public URL that the servers can reach. Therefore, running the server locally on my machine will not work. Is there a way I can remote debug my app? Any tips?
If running heroku local does not help, run a remote shell: heroku run -a <your app name> /bin/bash , and there run npm start to see the logs and debug the issue on the Heroku server.
Open the starting file (typically index. js ), activate the Run and Debug pane, and click the Run and Debug Node. js (F5) button. The debugging screen is similar to Chrome DevTools with a Variables, Watch, Call stack, Loaded scripts, and Breakpoints list.
I would consider using a tool to connect public URLs to an instance of your app running locally.
An easy one would be ngrok
If you have access to any Internet-facing server with ssh and admin rights to enable the GatewayPorts yes
sshd configuration, you can do it with ssh remote tunneling. For example:
ssh -n -R 8080:localhost:3000 myserver.example.com
Will allow webhooks sent to http://myserver.example.com:8080
to tunnel to your local app listening on port 3000.
More details on ssh tunneling can be found here
You can indeed debug webhooks on your local computer using a free proxy service like ngrok.
If you want to debug it on Heroku, you can view your real-time logs using heroku logs --tail
or use an addon service that stores logs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With