Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Bug: Chatwoot → Cloud API audio fails with `TypeError: t.mimetype?.startsWith is not a function

未关闭
#2,678 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
typescript
领域
api

调研方向

Trace the audio path named in the stack trace, starting at audioWhatsapp and following sendAttachment and receiveWebhook, then compare it with the direct Evolution API path. Use a real captured Chatwoot payload because the issue's mimetype examples are placeholders; done means the audio request no longer throws before reaching Meta while direct sending still works.

由索引模型根据 Issue 内容生成。

描述

bug
📋 Bug Description

Environment

  • Evolution API: v2.3.7
  • Chatwoot: latest
  • Integration: WhatsApp Business Cloud API
  • Storage: IDrive E2 (S3 compatible)
  • Docker deployment

Problem

Sending an audio attachment from Chatwoot to a WhatsApp Cloud API instance fails with:

TypeError: t.mimetype?.startsWith is not a function
    at Ls.audioWhatsapp
    at ut.sendAttachment
    at ut.receiveWebhook

Text messages, images and PDFs are sent successfully. Only audio attachments are affected.

Reproduction

  1. Configure Chatwoot with Evolution API.
  2. Configure a WhatsApp Business Cloud API instance.
  3. Open a conversation.
  4. Send an audio message from the Chatwoot interface.
  5. The request fails before reaching Meta.

Comparison

Scenario A — audio sent directly using the Evolution API endpoint
Result: ✅ No mimetype?.startsWith exception. Evolution continues processing normally.

Scenario B — the exact same audio sent from Chatwoot
Result: ❌ Exception thrown immediately, before the request reaches Meta:

TypeError: t.mimetype?.startsWith is not a function

Payload comparison (anonymized)

Works — direct Evolution API call:

{
  "mimetype": "audio/ogg"
  // ...
}

Fails — via Chatwoot:

{
  "mimetype": null
  // or {}, or the actual captured value — TO FILL IN
}

(placeholder — replace with the real captured object once logged; see note below)

Expected behavior

Evolution should correctly detect or normalize the attachment MIME type received from Chatwoot before calling audioWhatsapp(). Since ?. only guards against null/undefined, a non-null, non-string mimetype (object, array, etc.) reaches .startsWith() unguarded and throws.

Additional information

This appears to affect only the Chatwoot → Cloud API attachment flow. The direct Evolution API → Cloud API flow works correctly.

If necessary, I can provide the complete stack trace, the Chatwoot payload, the Evolution payload, and a full comparison between both requests.

🔄 Steps to Reproduce
  1. Configure Chatwoot with Evolution API.
  2. Configure a WhatsApp Business Cloud API instance.
  3. Open a conversation in Chatwoot.
  4. Send an audio message from the Chatwoot interface.
  5. Request fails with TypeError before reaching Meta:
    TypeError: t.mimetype?.startsWith is not a function
    at Ls.audioWhatsapp
    at ut.sendAttachment
    at ut.receiveWebhook

Note: sending the same audio directly via the Evolution API endpoint (bypassing Chatwoot) works fine — no exception.

✅ Expected Behavior

Evolution should correctly detect or normalize the attachment MIME type received from Chatwoot before calling audioWhatsapp()

❌ Actual Behavior

TypeError: t.mimetype?.startsWith is not a function
at Ls.audioWhatsapp
at ut.sendAttachment
at ut.receiveWebhook

🌍 Environment
  • OS: [e.g. Ubuntu 20.04, Windows 10, macOS 12.0]
  • Node.js version: [e.g. 18.17.0]
  • Evolution API version: [e.g. 2.3.7]
  • Database: [e.g. PostgreSQL 14, MySQL 8.0]
  • Connection type: [e.g. Baileys, WhatsApp Business API]
📋 Logs

📝 Additional Context

No response

主要语言
TypeScript
星标
9.6k
派生
7.3k
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

evolution-foundation/evolution-api 的其他 Issue

查看 evolution-foundation/evolution-api 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。