pulsar-client-node icon indicating copy to clipboard operation
pulsar-client-node copied to clipboard

Retryable Exception

Open tomasantunes opened this issue 2 years ago • 3 comments

I'm getting the following error when trying to create a producer with Pulsar Node JS client:

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: Failed to create producer: Retryable]

tomasantunes avatar Oct 03 '23 09:10 tomasantunes

Can you share your reproduction code?

shibd avatar Oct 07 '23 02:10 shibd

I face the same issue when deploying with 3.1.x docker-compose. If I docker-compose up the default compose from the site on my host and connect to it with pulsar://127.0.0.1:6650 it works as expected. However, if I add my producer service into docker-compose file along with simple redis as:

  worker:
    restart: unless-stopped
    networks:
      - pulsar
    command: node src/worker.js
    environment:
      REDIS_URL: redis://redis:6379
      PULSAR_URL: pulsar://broker:6650
    build:
      context: .
    deploy:
      replicas: 3
    depends_on:
      zookeeper:
        condition: service_healthy
      redis:
        condition: service_healthy
      bookie:
        condition: service_started
  redis:
    image: redis:7
    networks:
      - pulsar
    volumes:
      - ./redis-data:/data
    command: redis-server --io-threads 4 --io-threads-do-reads yes --appendonly no --maxmemory-policy noeviction --bind 0.0.0.0 --maxclients 100000 --tcp-backlog 100000
    healthcheck:
      test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
      interval: 3s
      timeout: 5s
      retries: 5

I got this error [Error: Failed to create producer: Retryable]

I verified that broker is pingable from worker container, tried different combinations of networks and other stuff, still can't figure out what could be the issue

Producer code is also default, if simplified:

const URL = process.env.PULSAR_URL || 'pulsar://127.0.0.1:6650';
export const client = new PulsarClient.Client({serviceUrl: URL});
await client.createProducer({topic: 'my-topic',sendTimeoutMs: 1000}).catch(console.error);

UPD Fixed it by changing env variable for broker service from - advertisedListeners=external:pulsar://127.0.0.1:6650 to - advertisedListeners=external:pulsar://broker:6650

viktorvsk avatar Dec 31 '23 09:12 viktorvsk

@tomasantunes For your information , I reproduce the trouble with the 1.11.0 of the pulsar-client, but no trouble with 1.10.0 ...

slobberbone avatar May 27 '24 10:05 slobberbone