question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with port forwarding

See original GitHub issue

I have a BullMQ + redis instance in k8s that I am trying to connect to

First I port forward:

kubectl port-forward --namespace default svc/redis-master 54321:6379 &

Then with bull-repl@next:

BULL-REPL> connect -r redis://localhost:54321 my-queue Handling connection for 54321 connect ECONNREFUSED 127.0.0.1:6379 BULL-REPL> (node:812) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1117:14) (node:812) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:812) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. [ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1117:14)

I can connect ok with rdcli

~$ rdcli -p 54321 127.0.0.1:54321> Handling connection for 54321

127.0.0.1:54321>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jamesholcombcommented, Feb 20, 2020

The thread seems to suggest using bind 0.0.0.0 in the redis config. I use the bitnami helm chart which already does this.

I tried testing with a simple ioredis@4.16.0 setup using the port forwarding from above (rdcli does not use ioredis):

const Redis = require("ioredis")

const redis = new Redis("redis://localhost:54321")

redis.info().then((res) => {
  console.log(res)

  process.exit(0)
})

output was

Handling connection for 54321
# Server
redis_version:5.0.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:3259c77a1d3a0c8d
redis_mode:standalone
os:Linux 4.14.138+ x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:6.3.0
process_id:1
run_id:04681e84ee9177cde753db0ec7ee744b2a643a17
tcp_port:6379
uptime_in_seconds:49342
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:5111033
executable:/opt/bitnami/redis/bin/redis-server
config_file:/opt/bitnami/redis/etc/redis.conf

If I do bull-repl connect -r 127.0.0.1:54321 myqueue, it connects, but it is my local macOS redis instance, not the one port forwarded on k8s.

0reactions
jamesholcombcommented, Aug 17, 2021

Are you on @latest or @next?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Troubleshoot Port Forwarding Issues
Verify the destination device's WAN IP is reachable from the source device. · Verify that you have the correct TCP/IP information on the...
Read more >
What to do if port forwarding does not work - Keenetic
1. In a port forwarding rule, the incoming interface is not correctly selected. · 2. Your computer uses a firewall or special software...
Read more >
Why Is Port Forwarding Not Working? Here's How To Fix
How To Fix Port Forwarding Not Working · Check for Errors in the Configuration Settings · Restart Your Router · Examine Internet Connection...
Read more >
Why port forwarding feature is not working on my Wi-Fi router ...
Step 1: Make sure the server is accessible from the internal network · Step 2: Check the port forwarding settings in the router....
Read more >
Common Problems & Fixes for Port Forwarding - PureVPN Blog
Common Problems & Fixes for Port Forwarding · Problem 1: Firewall in different Operating Systems · Problem 2: Broken Windows Firewall · Problem...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found