[BUG] /chat/findMessages ignores where.key.fromMe when value is false
Maintainers usually reply within 4 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- postgresql, typescript
Research direction
Start in src/api/services/channel.service.ts at fetchMessages, where the issue identifies the count and findMany queries as dropping the false filter. Read those query conditions and check for tests covering where.key.fromMe; done means both queries apply the filter when its value is false, and the endpoint returns only received messages.
Written by the indexing model from the issue text.
Description
Welcome!
- Yes, I have searched for similar issues on GitHub and found none.
Related: #1797 reported this same bug and was closed as completed on 2025-09-09, but no fix was merged. The code is unchanged on main, develop and 2.4.0-rc2.
What did you do?
Called POST /chat/findMessages/{instance} to get only received messages:
{
"where": {
"key": {
"fromMe": false
}
}
}
What did you expect?
Only messages with key.fromMe === false are returned.
What did you observe instead of what you expected?
The filter is ignored. The response has every message of the instance (total is the full count, and records include fromMe: true). fromMe: true works.
Cause, in src/api/services/channel.service.ts (fetchMessages, both the count and the findMany query):
keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
false is falsy, so the condition becomes {} and the filter is dropped. Suggested fix:
keyFilters?.fromMe !== undefined ? { key: { path: ['fromMe'], equals: keyFilters.fromMe } } : {},
Checked on a real instance: the API returns 48569 records with fromMe: false, while the database has 39762 rows where key->>'fromMe' = 'false'.
Which version of the API are you using?
2.1.1. Same code on main (2.3.7), develop and 2.4.0-rc2 (lines 627 and 651).
What is your environment?
Docker
Other environment specifications
Image evoapicloud/evolution-api:v2.1.1, PostgreSQL 16.
Additional Notes
Workaround until fixed: query the Message table directly, or filter on the client side.
- Dominant language
- TypeScript
- Stars
- 10.2k
- Forks
- 7.5k
- Avg merge
- 6d 19h
- Merged PRs (30d)
- 4
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from evolution-foundation/evolution-api
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
evolution-foundation/evolution-api#2795 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
evolution-foundation/evolution-api#2782 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
evolution-foundation/evolution-api#2723 ·
Maintainers usually reply within 4 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
evolution-foundation/evolution-api#2704 ·
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
evolution-foundation/evolution-api#2702 · 3 comments · 3 reactions ·
Maintainers usually reply within 4 days
All issues in evolution-foundation/evolution-api
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
abhigyanpatwari/GitNexus#4124 ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
laaielichter/Godotwright#250 ·
Maintainers usually reply within 1 day
-
An Antigravity tab can quote an old Assist message as the owner's words in a resumed conversationOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Retry an empty final answer when Gemini reports MALFORMED_RESPONSE (gemini-4-hydrogen)Possibly taken @waleedkadous claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
iaser-ai/ansari#444 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug]: Manager UI logo fails to load — broken external URLPossibly taken @kavindu-udara claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100