添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I’ve read through all the forums related to this problem but I can’t find a solution. I have a web application, a worker and a redis instance set up in fly. The webapp is not connecting the the redis instance correctly. Here’s the web app toml. I’m using BullMQ to create the queue and the job is created fine. That seems to work. The error Error: connect ECONNREFUSED 127.0.0.1:6379 is continually logged and the queue cannot listen to onComplete changes.

app = "vel-new"
kill_signal = "SIGINT"
kill_timeout = 5
processes = [ ]
[env]
PORT = "8080"
[experimental]
allowed_public_ports = [ ]
auto_rollback = true
private_network = true 
[[services]]
internal_port = 8_080
processes = [ "app" ]
protocol = "tcp"
script_checks = [ ]
  [services.concurrency]
  hard_limit = 25
  soft_limit = 20
  type = "connections"
  [[services.ports]]
  handlers = [ "http" ]
  port = 80
  force_https = true
  [[services.ports]]
  handlers = [ "tls", "http" ]
  port = 443
  [[services.tcp_checks]]
  grace_period = "1s"
  interval = "15s"
  restart_limit = 0
  timeout = "2s"
              

I know that BullMQ uses the REDIS_URL environment variable and I think you said that part worked, so I’m wondering if your web app is also using REDIS_URL or not, because the error implies it is not. If it’s a Node.js app, not all the Redis client libraries will default to using the environment variable and you need to pass in process.env.REDIS_URL so it could be that.

According to BullMQ, they just pass the connection options on to ioredis, which “will default to port 6379 and localhost”, see https://docs.bullmq.io/guide/connections.
I ran in to the same issue where it tried to connect to localhost. For me, the issue was that I didn’t pass the connection options to every QueueEvents object. Make sure to set the right connection options on all queues, workers, and queue-events you’re using from BullMQ, since otherwise it will default to localhost.