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

Podman - Perda da conexão container evolution-api com postgres

Open benjamimprofissional-web opened this issue 4 weeks ago • 0 comments

Welcome!

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

What did you do?

Tenho dois conteiners no podman, um com evolution-api e outro com postgres, já fiz vários ajustes no postgres e evolution mas mesmo assim o prisma perde a conexão com o banco e não volta de maneira automática. Nos logs do postgres não ocorre erro, apenas nos logs do evolution-api. Ao reiniciar o conteiner do evoltuion-api a comunicação e mensagens voltam ao normal. Depois de um tempo mais ou menos 1h, os logs de erro começam e o evolution-api não responde. Acredito que isso ocorra por conta de inatividade de mensagens mas acredito que não é o correto, mesmo nessas circunstâncias.

Configurei até o conteiner pgbouncer para intermediar a comunicação entre o evolution-api e o postgres mas mesmo assim não deu certo.

Segue meu compose:

postgres: image: ankane/pgvector container_name: postgres restart: unless-stopped ports:

  • "5433:5432" env_file:
  • .env sysctls:
  • net.ipv4.tcp_keepalive_time=60
  • net.ipv4.tcp_keepalive_intvl=30
  • net.ipv4.tcp_keepalive_probes=5 volumes:
  • postgres_data:/var/lib/postgresql/data networks:
  • minha_rede healthcheck: test: ["CMD-SHELL", "pg_isready -U ipmar -d evolution_db"] interval: 5s timeout: 3s retries: 5 start_period: 10s

pgbouncer: image: edoburu/pgbouncer container_name: pgbouncer restart: unless-stopped ports:

  • "6432:6432" environment: DB_HOST: postgres DB_PORT: 5432 DB_USER: "user do postgres" DB_PASSWORD: "senha do postgres" POOL_MODE: transaction MAX_CLIENT_CONN: 200 DEFAULT_POOL_SIZE: 20 networks:
  • minha_rede

evolution-api: container_name: lab_evolution_api image: evoapicloud/evolution-api:latest restart: on-failure ports:

  • "18080:8080" volumes:
  • lab_evolution_instances:/lab_evolution/instances env_file:
  • .env networks:
  • minha_rede depends_on: redis: condition: service_started postgres: condition: service_healthy

Alguém tem alguma sugestão ou se não é recomendado mesmo usar o evolution-api em conteiner devido a essas desconexões?

What did you expect?

Conexão estável sem desconexões

What did you observe instead of what you expected?

Desconexões depois de aproximadamente 1h sem interações.

Screenshots/Videos

No response

Which version of the API are you using?

Evolution 2.3.6

What is your environment?

Other

Other environment specifications

Podman

If applicable, paste the log output

Segue o ERRO:

[Evolution API] [teste] v2.3.6 169 - Fri Nov 14 2025 14:40:52 LOG [ChannelStartupService] [string] Update as read in message.update [email protected] - 1763130890 [Evolution API] v2.3.6 169 - Fri Nov 14 2025 15:17:44 ERROR [unhandledRejection] [object] { origin: Promise { PrismaClientKnownRequestError: Invalid a.integrationSession.update() invocation in /evolution/dist/main.js:173:12553 170 ));let t="";s.bold&&(t+=""),s.italic&&(t+="_"),s.underline&&(t+="~");let o=${t}${e}${t.split("").reverse().join("")};return s.url&&(o=s.children[0]?.text?[${o}] 171 (${s.url}):${s.url}),o}async processMessages(s,e,t,o,i,n,r,a){let c=(u,l)=>{if(!u)return null;for(let d of u)if(d.lastBubbleBlockId===l)return d.wait?.secondsToWaitFor;return null};for(let u of o){if(u.type==="text"){let d="";for(let g of u.content.richText){for(let h of g.children)d+=r(h);d+= 172 }d=d.replace(/**/g,"").replace(/__/,"").replace(/~~/,"").replace(/\n$/,""),d=d.replace(/\n$/,""),d.includes("[list]")?await this.processListMessage(s,d,e.remoteJid):d.includes("[buttons]")?await this.processButtonMessage(s,d,e.remoteJid):await this.sendMessageWhatsApp(s,e.remoteJid,d,t,!0),q("/message/sendText")}u.type==="image"&&(await s.mediaMessage({number:e.remoteJid.split("@")[0],delay:t?.delayMessage||1e3,mediatype:"image",media:u.content.url},null,!1),q("/message/sendMedia")),u.type==="video"&&(await s.mediaMessage({number:e.remoteJid.split("@")[0],delay:t?.delayMessage||1e3,mediatype:"video",media:u.content.url},null,!1),q("/message/sendMedia")),u.type==="audio"&&(await s.audioWhatsapp({number:e.remoteJid.split("@")[0],delay:t?.delayMessage||1e3,encoding:!0,audio:u.content.url},!1),q("/message/sendWhatsAppAudio"));let l=c(n,u.id);l&&await new Promise(d=>setTimeout(d,l1e3))}if(i){if(i.type==="choice input"){let u="",l=i.items;for(let d of l)u+=\u25B6\uFE0F ${d.content} → 173 ;u=u.replace(/\n$/,""),u.includes("[list]")?await this.processListMessage(s,u,e.remoteJid):u.includes("[buttons]")?await this.processButtonMessage(s,u,e.remoteJid):await this.sendMessageWhatsApp(s,e.remoteJid,u,t,!0),q("/message/sendText")}await a.integrationSession.update( Can't reach database server at postgres:5432 Please make sure your database server is running at postgres:5432. at ei.handleRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:7268) at ei.handleAndLogRequestError (/evolution/node_modules/@prisma/client/runtime/library.js:121:6593) at ei.request (/evolution/node_modules/@prisma/client/runtime/library.js:121:6300) at async a (/evolution/node_modules/@prisma/client/runtime/library.js:130:9551) at async eo.findSettings (/evolution/dist/main.js:173:12517) at async /evolution/dist/main.js:262:3034 { code: 'P1001', meta: [Object], clientVersion: '6.17.1' } }, stderr: 2 }

Additional Notes

No response