I have express.js
REST API server on Heroku.
I am trying to debug an error remotely. But, I receive below exception. The steps I tried to debug remote server are mentioned after this exception section.
Can someone please help me how can I debug remote node.js/express.js server?
The exception I receive:
events.js:291
throw er; // Unhandled 'error' event
^
Error: connection not allowed by ruleset
at Parser._onData (/usr/local/Cellar/heroku/7.47.11/lib/client/7.59.1/node_modules/@heroku/socksv5/lib/client.parser.js:122:21)
at Socket.Parser.__onData (/usr/local/Cellar/heroku/7.47.11/lib/client/7.59.1/node_modules/@heroku/socksv5/lib/client.parser.js:33:10)
at Socket.emit (events.js:314:20)
at addChunk (_stream_readable.js:297:12)
at readableAddChunk (_stream_readable.js:272:9)
at Socket.Readable.push (_stream_readable.js:213:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
Emitted 'error' event on Client instance at:
at Parser.<anonymous> (/usr/local/Cellar/heroku/7.47.11/lib/client/7.59.1/node_modules/@heroku/socksv5/lib/client.js:132:10)
at Parser.emit (events.js:314:20)
at Parser._onData (/usr/local/Cellar/heroku/7.47.11/lib/client/7.59.1/node_modules/@heroku/socksv5/lib/client.parser.js:126:16)
at Socket.Parser.__onData (/usr/local/Cellar/heroku/7.47.11/lib/client/7.59.1/node_modules/@heroku/socksv5/lib/client.parser.js:33:10)
[... lines matching original stack trace ...]
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
code: 'EACCES'
}
This is what I am trying:
- On my local Terminal, I run
heroku ps:forward 9229 --app MY_EXPRESS_APP
command. - On my local Visual Code, I have the below
launch.json
configuration. I tried with both the configurations mentioned in it. (I understand I need only one. But I checked other Stackoverflow articles. So, I tried both the suggestions).
"configurations": [
{
"address": "TCP/IP address of process to be debugged",
"localRoot": "${workspaceFolder}",
"name": "ONE: Attach to Remote",
"port": 9229,
"remoteRoot": "/app",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
},
{
"type": "node",
"request": "attach",
"name": "TWO: Remote Heroku: Debug Remote Server",
"address": "localhost",
"port": 9229,
"protocol": "inspector",
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
]
- I try to run below command. When I start Debug with above one of configuration... the debugger tries to connect and pauses. And, after 2 or 3 minutes, I see the above exception on Terminal under this command.
$ heroku ps:forward 9229 --app MY_EXPRESS_APP
heroku ps:forward 9229 --app MY_EXPRESS_APP
Establishing credentials... done
SOCKSv5 proxy server started on port 1080
Listening on 9229 and forwarding to web.1:9229
Use CTRL+C to stop port fowarding