Skip to content

QR Code never generates - infinite reconnection loop (v2.1.1, v2.2.3, v1.8.7) #2430

@DiegoNogueiraDev

Description

@DiegoNogueiraDev

Description

When creating a new instance with qrcode: true, the QR code is never generated. The /instance/connect/{name} endpoint always returns {"count": 0} instead of the expected base64 QR code. The instance enters an infinite reconnection loop, cycling through "Browser:", "Baileys version:", "Group Ignore:" logs every 3-5 seconds without ever producing a QR code.

Versions Tested

Version Result
v2.1.1 Infinite reconnection loop, {"count": 0}, Redis errors flooding logs
v2.2.3 Same infinite reconnection loop, {"count": 0}, even with Redis properly configured
v1.8.7 TypeError: Cannot read properties of undefined (reading 'db') on /instance/create

Environment

  • Host OS: Fedora 43, Linux 6.18.8
  • Docker: Running as Docker Compose service
  • Database: PostgreSQL 17 (pgvector) - shared with our application
  • Redis: Redis Alpine - connected and healthy
  • Network: All containers on same Docker Compose network

Docker Compose Configuration

evolution-api:
  image: atendai/evolution-api:v2.2.3
  container_name: mch-evolution
  environment:
    - SERVER_URL=http://localhost:8080
    - AUTHENTICATION_TYPE=apikey
    - AUTHENTICATION_API_KEY=mch-evolution-key
    - DATABASE_ENABLED=true
    - DATABASE_PROVIDER=postgresql
    - DATABASE_CONNECTION_URI=postgresql://mcp:mcp@postgres:5432/mcp_context_hub
    - DATABASE_SAVE_DATA_INSTANCE=true
    - DATABASE_SAVE_DATA_NEW_MESSAGE=false
    - DATABASE_SAVE_DATA_CONTACTS=false
    - DATABASE_SAVE_DATA_CHATS=false
    - CACHE_REDIS_ENABLED=true
    - CACHE_REDIS_URI=redis://redis:6379
    - CACHE_REDIS_PREFIX_KEY=evo
    - CACHE_LOCAL_ENABLED=false
    - QRCODE_LIMIT=30
    - QRCODE_COLOR=#198754
    - LOG_LEVEL=INFO
  ports:
    - "8080:8080"
  depends_on:
    postgres:
      condition: service_healthy
    redis:
      condition: service_healthy

Steps to Reproduce

  1. Start Evolution API with the above configuration
  2. Create an instance:
curl -X POST http://localhost:8080/instance/create \
  -H 'apikey: mch-evolution-key' \
  -H 'Content-Type: application/json' \
  -d '{"instanceName":"test","integration":"WHATSAPP-BAILEYS","qrcode":true}'
  1. Response shows "status": "connecting" and "qrcode": {"count": 0}
  2. Attempt to fetch QR code:
curl http://localhost:8080/instance/connect/test -H 'apikey: mch-evolution-key'
  1. Always returns {"count": 0}

Expected Behavior

The /instance/connect/{name} endpoint should return:

{
  "pairingCode": "WZYEH1YY",
  "code": "2@y8eK+bjtEjUWy9/...",
  "base64": "data:image/png;base64,iVBORw0KGgo...",
  "count": 1
}

Actual Behavior

v2.1.1 / v2.2.3

The endpoint returns {"count": 0} forever. Docker logs show an infinite loop:

[ChannelStartupService] Browser: Evolution API,Chrome,6.18.8-200.fc43.x86_64
[ChannelStartupService] Baileys version env: 2,3000,1015901307
[ChannelStartupService] Group Ignore: false

This repeats every 3-5 seconds indefinitely. The connection never stabilizes enough to generate a QR code.

On v2.1.1 specifically, there are also [Redis] redis disconnected errors flooding the logs when Redis is not configured (this is fixed by adding CACHE_REDIS_URI).

v1.8.7

{
  "status": 500,
  "error": "Internal Server Error",
  "response": {
    "message": ["TypeError: Cannot read properties of undefined (reading 'db')"]
  }
}

Related Issues

Context

We are integrating Evolution API as a WhatsApp gateway for our SaaS application. We need QR code generation to work so users can link their WhatsApp number. We've spent significant time testing multiple versions and configurations without success.

Any guidance on which version + configuration combination reliably generates QR codes would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions