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

[PT][BUG] Erro ao enviar áudio

Open nicocelli opened this issue 2 years ago • 17 comments

Título: Erro ao enviar audio pelo chatwoot

Descrição:

Ao tentar enviar um áudio gravado pelo chatwoot ocorre um erro nos logs do Evolution e o áudio não é recebido no whatsapp, veja o erro abaixo:

[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootController]  [string]  requested receiveWebhook from WppTeste instance 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [CacheService]  [string]  cacheservice created using cache engine: RedisCache 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  receive webhook to chatwoot instance: WppTeste 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  get client to instance: WppTeste 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [CacheService]  [string]  cacheservice has key: WppTeste:getProvider 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [CacheService]  [string]  cacheservice getting key: WppTeste:getProvider 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  provider found 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  create client to instance: WppTeste 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  client created 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  check if is bot 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  check if is group 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  check if is a message deletion 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  check if is group 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  Format message to send 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  check if message is media 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  message is media 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  send media to whatsapp 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  message do not have text 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Getting instance name 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  send attachment to instance: WppTeste 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  get media type 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  type: audio 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Getting instance name 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [ChatwootService]  [string]  send audio to instance: WppTeste 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Sending audio whatsapp 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Processing audio 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Hash to audio name: 5547992621482-1713810324880 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Audio is base64 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Output audio path: /evolution/store/temp/5547992621482-1713810324880.mp4 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Temp audio path: /evolution/store/temp/temp-5547992621482-1713810324880.mp3 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Temp audio created 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Converting audio to mp4 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Temp audio deleted 
[Evolution API]  [WppTeste]  v1.7.3  1   -  Mon Apr 22 2024 15:25:24     VERBOSE   [WAStartupService]  [string]  Audio converted to mp4 
[Evolution API]    v1.7.3  1   -  Mon Apr 22 2024 15:25:24     ERROR   [ChatwootService]  [object]   
Error: Command failed: /evolution/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -i /evolution/store/temp/temp-5547992621482-1713810324880.mp3 -vn -ab 128k -ar 44100 -f ipod /evolution/store/temp/5547992621482-1713810324880.mp4 -y
ffmpeg version N-47683-g0e8eb07980-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 42.100 / 58. 42.100
  libavformat    58. 24.100 / 58. 24.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[mp3 @ 0x5970c00] Format mp3 detected only with low score of 1, misdetection possible!
[mp3 @ 0x5970c00] Failed to read frame size: Could not seek to 1163.
/evolution/store/temp/temp-5547992621482-1713810324880.mp3: Invalid argument

    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:514:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: '/evolution/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -i /evolution/store/temp/temp-5547992621482-1713810324880.mp3 -vn -ab 128k -ar 44100 -f ipod /evolution/store/temp/5547992621482-1713810324880.mp4 -y'
} 

image

Passos para Reproduzir:

  1. Acessar o chatwoot conectado ao Evolution
  2. Enviar áudio pelo chatwoot

Comportamento Esperado:

O áudio deveria ser entregue corretamente no whatsapp.

Comportamento Atual:

O áudio não é entregue no whatsapp e o evolution apresenta erro no log.

Ambiente:

  • Servidor: Debian
  • Versão da API: v1.7.3 (mongo / redis)
  • Chatwoot: v3.8.0 Ambiente Docker

nicocelli avatar Apr 22 '24 18:04 nicocelli

Estou com o mesmo problema ao enviar imagem não carrega o conteúdo da imagem no cliente e os áudios não são enviados

Ambiente: Servidor Ubuntu Versão da API: v1.7.3 (mongo / redis) Chatwoot: v3.8.0 Ambiente Docker

Rafaell-dev avatar May 17 '24 02:05 Rafaell-dev

Mesmo problema, as imagens, audios e arquivos não são entregues ao chatwoot e vice versa, ao whastapp também não. image

gyancarlodasilva avatar May 19 '24 22:05 gyancarlodasilva

já resolveram? estou usando Docker servidor Ubuntu 20.04 versão latest da evolution-api(com mongo:7) chatwoot:latest-ce(com postgres:16 e redis:7) Não envia áudio através do chatwoot (aparece que não foi possível enviar áudio), não permite ouvir áudios enviados pelo WhatsApp (aparece tudo zerado) e também não apresenta stickers, somente imagens png ou jpeg

dpaes avatar Jul 03 '24 17:07 dpaes

Olá @dpaes !

Acabei migrando para outra API do whatsapp e decidi fazer a integração com o chatwoot internamente. Não sei como está essa questão no Evolution. Acredito que o @DavidsonGomes possa te orientar.

Abraço

nicocelli avatar Jul 03 '24 17:07 nicocelli

resolvi emitindo corretamente certificado SSL.

dpaes avatar Jul 05 '24 13:07 dpaes

@dpaes como que fazemos essa emissão do certificado SSL, teria algum passo a passo para nos ajudar, estou com o mesmo problema, obrigado

floresesampaio avatar Jul 25 '24 03:07 floresesampaio

@floresesampaio, procura digital interativo, astra online, orion design, automatik, rudnei nunes e entre outros que fazem video de como incluir o evolution com outras aplicações e mostram também como gerar o certificado ssl via traefik ou nginx, seja usando letsencrypt ou outros. Procure esses canais no youtube, vão te esclarecer bem.

dpaes avatar Jul 25 '24 11:07 dpaes

resolvi emitindo corretamente certificado SSL.

eu tenho o mesmo erro, eu recebo audios, mas na hora de enviar tenho a mesma mensagem

meus certificados são emitidos pelo traefik e estou usando cloudflare, estou com as ultimas versões do chatwoot e do evo

image

bendertk avatar Dec 03 '24 12:12 bendertk

Alguém encontrou a solução? estou com o mesmo problema.

{ status: 400, error: 'Bad Request', message: [ 'File buffer, URL, or base64 audio is required' ] }

fCaioRibeiro avatar Mar 13 '25 22:03 fCaioRibeiro

estava com esse problema de não enviar áudio isso resolveu : environment:

  • DIRECT_UPLOADS_ENABLED=true

jpa-weels avatar Mar 20 '25 19:03 jpa-weels

Consegui resolver. Minha instalação é via Easy Panel. Nas variáveis de ambiente eu alterei FORCE_SSL de false para true FORCE_SSL=true e adicionei... DIRECT_UPLOADS_ENABLED=true

Como sugerido por @dpaes e @jpa-weels

periclesbezerra avatar Apr 17 '25 12:04 periclesbezerra

Estou com o mesmo erro !!

Evolution 2.2.3 Chatwootn 3.15.7

Certificados OK

Tentei inserir as variáveis indicadas aqui FORCE_SSL=true e DIRECT_UPLOADS_ENABLED=true

O erro na Evolution:

[Evolution API]  [matec]  v2.2.3  212   -  Sat Apr 26 2025 09:57:24     ERROR   [ChannelStartupService]  [object]   

TypeError: Cannot read properties of undefined (reading '0')

    at ls.sendMessageWithTyping (/evolution/dist/main.js:221:479)

    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

    at async ls.audioWhatsapp (/evolution/dist/main.js:221:3468)

    at async Re.sendAttachment (/evolution/dist/main.js:82:10408)

    at async Re.receiveWebhook (/evolution/dist/main.js:84:232)

    at async fi.dataValidate (/evolution/dist/main.js:286:62716)

    at async /evolution/dist/main.js:286:99657 

[Evolution API]    v2.2.3  212   -  Sat Apr 26 2025 09:57:24     ERROR   [ChatwootService]  [object]   

{

  status: 400,

  error: 'Bad Request',

  message: [ "TypeError: Cannot read properties of undefined (reading '0')" ]

} 

[Evolution API]    v2.2.3  212   -  Sat Apr 26 2025 09:57:24     VERBOSE   [ChatwootService]  [string]  onSendMessageError undefined 

joaomachado-pg avatar Apr 26 '25 16:04 joaomachado-pg

mesmo problema aqui

dllsystem avatar Jul 03 '25 21:07 dllsystem

Conseguiram solução?

pedroramosuerj avatar Aug 12 '25 00:08 pedroramosuerj

Alguma solução?

agvirgula avatar Aug 21 '25 18:08 agvirgula

Precisa subir o chatwoot de forma correta. Tem que mexer nas configurações de armazenamento. Por aqui foi configurado pelo minio

https://developers.chatwoot.com/self-hosted/deployment/storage/supported-providers#using-amazon-s3-compatible-service

pedroramosuerj avatar Aug 21 '25 18:08 pedroramosuerj

Precisa subir o chatwoot de forma correta. Tem que mexer nas configurações de armazenamento. Por aqui foi configurado pelo minio

https://developers.chatwoot.com/self-hosted/deployment/storage/supported-providers#using-amazon-s3-compatible-service

@pedroramosuerj E aí é só colocar esses dados na env e ele puxa sozinho?

Eu coloquei, criei um bucket no s3, coloquei os dados, ele tá subindo as imagens no s3, mas nao tá enviando corretamente.... continua uma imagem cinza.

agvirgula avatar Aug 21 '25 19:08 agvirgula