evolution-api icon indicating copy to clipboard operation
evolution-api copied to clipboard

WhatsApp session disconnects after some time on Railway (Redis enabled)

Open karlitobraga opened this issue 11 months ago • 2 comments

Welcome!

  • [x] Yes, I have searched for similar issues on GitHub and found none.

What did you do?

I'm running Evolution API on Railway and facing a session persistence issue.

The QR Code is generated correctly, the WhatsApp device connects successfully, and the instance shows as connected in the Evolution panel. However, after some time (or after a Railway service restart), the WhatsApp session disconnects automatically, requiring a new QR Code scan.

This happens even though Redis and PostgreSQL are configured.

What did you expect?

AUTHENTICATION_API_KEY="dlkasmdsauteytrlpclxpclxpxnsjahdg" AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES="true" CACHE_LOCAL_ENABLED="false" CACHE_REDIS_ENABLED="true" CACHE_REDIS_PREFIX_KEY="evolution" CACHE_REDIS_SAVE_INSTANCES="false" CACHE_REDIS_URI="${{Redis.REDIS_URL}}" CONFIG_SESSION_PHONE_CLIENT="Evolution" CONFIG_SESSION_PHONE_NAME="Chrome" DATABASE_CONNECTION_CLIENT_NAME="${{Postgres.PGUSER}}" DATABASE_CONNECTION_URI="${{Postgres.DATABASE_URL}}" DATABASE_ENABLED="true" DATABASE_PROVIDER="postgresql" DATABASE_SAVE_DATA_CHATS="true" DATABASE_SAVE_DATA_CONTACTS="true" DATABASE_SAVE_DATA_HISTORIC="true" DATABASE_SAVE_DATA_INSTANCE="true" DATABASE_SAVE_DATA_LABELS="true" DATABASE_SAVE_DATA_NEW_MESSAGE="true" DATABASE_SAVE_MESSAGE_UPDATE="true" DEL_INSTANCE="false" DIFY_ENABLED="true" EVOAI_ENABLED="true" LANGUAGE="pt-BR" N8N_ENABLED="true" OPENAI_ENABLED="true" PROVIDER_ENABLED="false" PROVIDER_HOST="127.0.0.1" PROVIDER_PORT="5656" PROVIDER_PREFIX="evolution" QRCODE_LIMIT="1902" SERVER_URL="https://${{RAILWAY_PUBLIC_DOMAIN}}" TELEMETRY="false" TYPEBOT_API_VERSION="latest" TYPEBOT_ENABLED="true" WA_BUSINESS_LANGUAGE="pt_BR" WA_BUSINESS_TOKEN_WEBHOOK="evolution" WA_BUSINESS_URL="https://graph.facebook.com" WA_BUSINESS_VERSION="v21.0" WEBHOOK_REQUEST_TIMEOUT_MS="60000" WEBHOOK_RETRY_INITIAL_DELAY_SECONDS="5" WEBHOOK_RETRY_JITTER_FACTOR="0.2" WEBHOOK_RETRY_MAX_ATTEMPTS="10" WEBHOOK_RETRY_MAX_DELAY_SECONDS="300" WEBHOOK_RETRY_NON_RETRYABLE_STATUS_CODES="400,401,403,404,422" WEBHOOK_RETRY_USE_EXPONENTIAL_BACKOFF="true" WEBSOCKET_ENABLED="true" WEBSOCKET_GLOBAL_EVENTS="true" CONFIG_SESSION_PHONE_VERSION="2.3000.1031008584"

What did you observe instead of what you expected?

AUTHENTICATION_API_KEY="dlkasmdsauteytrlpclxpclxpxnsjahdg" AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES="true" CACHE_LOCAL_ENABLED="false" CACHE_REDIS_ENABLED="true" CACHE_REDIS_PREFIX_KEY="evolution" CACHE_REDIS_SAVE_INSTANCES="false" CACHE_REDIS_URI="${{Redis.REDIS_URL}}" CONFIG_SESSION_PHONE_CLIENT="Evolution" CONFIG_SESSION_PHONE_NAME="Chrome" DATABASE_CONNECTION_CLIENT_NAME="${{Postgres.PGUSER}}" DATABASE_CONNECTION_URI="${{Postgres.DATABASE_URL}}" DATABASE_ENABLED="true" DATABASE_PROVIDER="postgresql" DATABASE_SAVE_DATA_CHATS="true" DATABASE_SAVE_DATA_CONTACTS="true" DATABASE_SAVE_DATA_HISTORIC="true" DATABASE_SAVE_DATA_INSTANCE="true" DATABASE_SAVE_DATA_LABELS="true" DATABASE_SAVE_DATA_NEW_MESSAGE="true" DATABASE_SAVE_MESSAGE_UPDATE="true" DEL_INSTANCE="false" DIFY_ENABLED="true" EVOAI_ENABLED="true" LANGUAGE="pt-BR" N8N_ENABLED="true" OPENAI_ENABLED="true" PROVIDER_ENABLED="false" PROVIDER_HOST="127.0.0.1" PROVIDER_PORT="5656" PROVIDER_PREFIX="evolution" QRCODE_LIMIT="1902" SERVER_URL="https://${{RAILWAY_PUBLIC_DOMAIN}}" TELEMETRY="false" TYPEBOT_API_VERSION="latest" TYPEBOT_ENABLED="true" WA_BUSINESS_LANGUAGE="pt_BR" WA_BUSINESS_TOKEN_WEBHOOK="evolution" WA_BUSINESS_URL="https://graph.facebook.com" WA_BUSINESS_VERSION="v21.0" WEBHOOK_REQUEST_TIMEOUT_MS="60000" WEBHOOK_RETRY_INITIAL_DELAY_SECONDS="5" WEBHOOK_RETRY_JITTER_FACTOR="0.2" WEBHOOK_RETRY_MAX_ATTEMPTS="10" WEBHOOK_RETRY_MAX_DELAY_SECONDS="300" WEBHOOK_RETRY_NON_RETRYABLE_STATUS_CODES="400,401,403,404,422" WEBHOOK_RETRY_USE_EXPONENTIAL_BACKOFF="true" WEBSOCKET_ENABLED="true" WEBSOCKET_GLOBAL_EVENTS="true" CONFIG_SESSION_PHONE_VERSION="2.3000.1031008584"

Screenshots/Videos

No response

Which version of the API are you using?

2.2.3

What is your environment?

Windows

Other environment specifications

No response

If applicable, paste the log output

No response

Additional Notes

No response

karlitobraga avatar Dec 15 '25 06:12 karlitobraga

Isso é o próprio WhatsApp que limita. Se você olhar os logs, vai ver que ele acusa como se estivesse havendo concorrência ou duplicidade de conexões. Quando acontece desinstalo o WhatsApp, apago a instância criada, em seguida crio outra com um nome diferente e aí funciona normal.

Vi também que não pode ter mais nenhuma outra instancia conectada com o whatsapp web, só não tenho certeza dessa informação, preferir não arriscar e só conecto o próprio evolution.

Estou utilizando a última versão do evolution

renatojuniordw avatar Dec 16 '25 15:12 renatojuniordw

Olá! Estamos fazendo uma triagem do backlog para focar nos bugs reproduzíveis nas versões atuais.

Esta issue foi reportada em uma versão anterior do Evolution API, sem atividade recente. Nesse intervalo lançamos várias versões com correções e mudanças significativas no Baileys, na camada de webhooks e na integração com Cloud API.

Versões atuais:

  • Latest stable: v2.3.7 (Dezembro/2025)
  • Pre-release: 2.4.0-rc2 (Maio/2026) — recomendada para testar fixes mais recentes

Vamos fechar esta issue por inatividade. Se você ainda reproduz o problema na 2.3.7 ou na 2.4.0-rc2, por favor:

  1. Abra uma nova issue usando o template Bug Report
  2. Inclua: versão exata testada, passos para reproduzir, logs do servidor, payload de exemplo
  3. Linke esta issue na nova para preservar o histórico

Obrigado pela contribuição original e pela paciência!

DavidsonGomes avatar May 19 '26 14:05 DavidsonGomes