[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error: connect ECONNREFUSED 127.0.0.1:6379 #2764

Closed
1 task done
sampod76 opened this issue Sep 8, 2024 · 2 comments
Closed
1 task done

[Bug]: Error: connect ECONNREFUSED 127.0.0.1:6379 #2764

sampod76 opened this issue Sep 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@sampod76
Copy link
sampod76 commented Sep 8, 2024

Version

5.12.14

Platform

NodeJS

What happened?

BullMq works fine when I work locally. When I run docker compose build there is no more BullMq redis connection. I have used IOredis for data caching in the same service and it works fine

first option
export const emailQueue = new Queue(ENUM_QUEUE_NAME.email, {
connection: {
host: 'redis', // Replace with your redis container name (if different)
port: 6379,
}}

secound option
export const emailQueue = new Queue(ENUM_QUEUE_NAME.email, {
connection: {
host: ''127.0.0.1'', // Replace with your redis container name (if different)
port: 6379,
},

docker compose
version: '3'
services:
dr_mazen_app:
build:
context: .
dockerfile: Dockerfile
ports:
- '5010:5003'
- '5011:5004'
depends_on:
- redis
- mongodb
- zookeeper
- kafka
environment:
- REDIS_URL=redis://redis:6379
- REDIS_HOST=redis
- REDIS_PORT=6379
- DATABASE_URL_ATLAS=mongodb://mongodb:27017/renti_v2
networks:
- default
redis:
image: redis:latest
ports:
- '6379:6379'
volumes:
- redis_data:/data # Named volume for Redis data
networks:
- default

Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 6379 }
image

How to reproduce.

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@sampod76 sampod76 added the bug Something isn't working label Sep 8, 2024
@fourslashw
Copy link
fourslashw commented Oct 23, 2024

UPD: nevermind was my mistake

Having exact same issue on 5.13.0, 5.21.2

Steps for reproducing issue:

  1. Launch redis on non-standart port 6380
  2. Try to launch app without setting right port with ioredis connection and bullmq using the same connection - ioredis fails to connect as expected
  3. Set connections string redis://127.0.0.1:6380 for ioredis - ioredis connects successfully, but bullmq still tries to connect to 127.0.0.1:6379

Bullmq initialised similarly to this:

import Redis from 'ioredis';
import { Queue } from 'bullmq';
const redis = new Redis(process.env.REDIS_URL, { maxRetriesPerRequest: null });
new Queue<JobData, Data[]>('some-name', {
      connection: redis,
});

@fourslashw
Copy link

Nevermind, we had FlowProducer initialisation somewhere in project without properly setting connection options for it

@manast manast closed this as completed Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants