Trying to run this on heroku dyno
CoinCoderBuffalo opened this issue · 4 comments
CoinCoderBuffalo commented
I see tor running on the heroku dyno:
Nov 06 02:48:46.042 [notice] Tor 0.3.2.10 (git-0edaa32732ec8930) running on Linux with Libevent 2.1.8-stable, OpenSSL 1.1.1, Zlib 1.2.11, Liblzma 5.2.2, and Libzstd 1.3.3.
Nov 06 02:48:46.046 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Nov 06 02:48:46.046 [notice] Configuration file "/etc/tor/torrc" not present, using reasonable defaults.
Nov 06 02:48:46.053 [notice] Scheduler type KIST has been enabled.
Nov 06 02:48:46.053 [notice] Opening Socks listener on 127.0.0.1:9050
Nov 06 02:48:46.000 [notice] Bootstrapped 0%: Starting
Nov 06 02:48:46.000 [notice] Starting with guard context "default"
Nov 06 02:48:47.000 [notice] Bootstrapped 5%: Connecting to directory server
Nov 06 02:48:47.000 [notice] Bootstrapped 10%: Finishing handshake with directory server
Nov 06 02:48:47.000 [notice] Bootstrapped 15%: Establishing an encrypted directory connection
Nov 06 02:48:47.000 [notice] Bootstrapped 20%: Asking for networkstatus consensus
Nov 06 02:48:47.000 [notice] Bootstrapped 25%: Loading networkstatus consensus
Nov 06 02:48:48.000 [notice] I learned some more directory information, but not enough to build a circuit: We have no usable consensus.
Nov 06 02:48:48.000 [notice] Bootstrapped 40%: Loading authority key certs
Nov 06 02:48:48.000 [notice] Bootstrapped 45%: Asking for relay descriptors
Nov 06 02:48:48.000 [notice] I learned some more directory information, but not enough to build a circuit: We need more microdescriptors: we have 0/5880, and can only build 0% of likely paths. (We have 0% of guards bw, 0% of midpoint bw, and 0% of exit bw = 0% of path bw.)
Nov 06 02:48:49.000 [notice] Bootstrapped 50%: Loading relay descriptors
Nov 06 02:48:49.000 [notice] Bootstrapped 56%: Loading relay descriptors
Nov 06 02:48:49.000 [notice] Bootstrapped 64%: Loading relay descriptors
Nov 06 02:48:50.000 [notice] Bootstrapped 71%: Loading relay descriptors
Nov 06 02:48:50.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Nov 06 02:48:50.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Nov 06 02:48:50.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Nov 06 02:48:51.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Nov 06 02:48:51.000 [notice] Bootstrapped 100%: Done
But I get the following error when trying to use tor-request:
2019-11-06T02:50:01.702237+00:00 app[web.2]: SocksClientError: connect ECONNREFUSED 127.0.0.1:9050
2019-11-06T02:50:01.702241+00:00 app[web.2]: - Are you running `tor`?
2019-11-06T02:50:01.702244+00:00 app[web.2]: See easy guide here (OSX, Linux, Windows):
2019-11-06T02:50:01.702247+00:00 app[web.2]: https://github.com/talmobi/tor-request#requirements
2019-11-06T02:50:01.702255+00:00 app[web.2]:
2019-11-06T02:50:01.702257+00:00 app[web.2]: Quickfixes:
2019-11-06T02:50:01.702260+00:00 app[web.2]: OSX: `brew install tor && tor` # installs and runs tor
2019-11-06T02:50:01.702262+00:00 app[web.2]: Debian/Ubuntu: `apt-get install tor` # should auto run as daemon after install
2019-11-06T02:50:01.702264+00:00 app[web.2]:
2019-11-06T02:50:01.702267+00:00 app[web.2]: at SocksClient._closeSocket (/app/node_modules/socks/build/client/socksclient.js:363:32)
2019-11-06T02:50:01.702269+00:00 app[web.2]: at SocksClient.onError (/app/node_modules/socks/build/client/socksclient.js:336:14)
2019-11-06T02:50:01.702271+00:00 app[web.2]: at Socket._onError (/app/node_modules/socks/build/client/socksclient.js:202:39)
2019-11-06T02:50:01.702273+00:00 app[web.2]: at Object.onceWrapper (events.js:300:26)
2019-11-06T02:50:01.702276+00:00 app[web.2]: at Socket.emit (events.js:210:5)
2019-11-06T02:50:01.702278+00:00 app[web.2]: at Socket.EventEmitter.emit (domain.js:476:20)
2019-11-06T02:50:01.702280+00:00 app[web.2]: at emitErrorNT (internal/streams/destroy.js:92:8)
2019-11-06T02:50:01.702282+00:00 app[web.2]: at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
2019-11-06T02:50:01.702285+00:00 app[web.2]: at processTicksAndRejections (internal/process/task_queues.js:80:21) {
2019-11-06T02:50:01.702287+00:00 app[web.2]: options: {
2019-11-06T02:50:01.702289+00:00 app[web.2]: proxy: { ipaddress: '127.0.0.1', port: 9050, type: 5 },
2019-11-06T02:50:01.702291+00:00 app[web.2]: destination: { port: 80, host: 'jthnx5wyvjvzsxtu.onion' },
2019-11-06T02:50:01.702294+00:00 app[web.2]: command: 'connect'
2019-11-06T02:50:01.702296+00:00 app[web.2]: }
2019-11-06T02:50:01.702298+00:00 app[web.2]: }
talmobi commented
Looks OK. Are you running them at the same time?
CoinCoderBuffalo commented
I will double check, but don't think so.
talmobi commented
Open another shell (another terminal/tab + ssh, or use tmux/screen) or run the tor process in the background (using the & operator for example) and then run your code.
The tor process has to be running at the same time because this module will connect to the server/endpoint that the tor process will provide for us when it is running.
CoinCoderBuffalo commented
Finally got this working by adding "tor" to the Heroku Procfile. Thanks!