Convex CommunityCCConvex Community
Powered by
Cybern3rdC
Convex Community•2w ago•
4 replies
Cybern3rd

WebSocket returns data that doesn't exist in database (CLI works fine)

🪲Bug Report
1. Full-scope summary
Problem: The frontend gets prayer data over the Convex WebSocket that does not exist in the database (and sometimes the returned document _id is from another table, e.g. notificationSettings). The same Convex deployment returns correct data when queried via the CLI (e.g. empty array when no prayer exists). So we have a WebSocket vs CLI data mismatch for the same deployment and same logical query.

Key details:

Code: A mutation queries prayers by language and date and returns the first result (or null). Via WebSocket it returns a document; via CLI it returns []/null when no prayer exists.
Schema: Table prayers with index by_language_and_date on language and date. The phantom document’s _id is from table notificationSettings, not prayers.
Observed: Same wrong result with queries, actions, and mutations over WebSocket; different browsers/devices; cache cleared; redeployed. CLI is always correct.

2. Version & environment
Detail Value
Convex version 1.31.5
Convex client version 1.31.5 (convex npm package)
Programming language TypeScript
Runtime (with version) Node v24.13.0
(Framework: Next.js 16.1.3, React 19.2.3)

3. Reproducible scenario (bug)
Steps:

CLI – correct behaviour
Run:
npx convex run "prayers:debugListAllPrayers" '{"date": "2026-02-01", "language": "en"}'
Result: [] (no prayer exists for that date/language).

WebSocket – wrong behaviour
In the app, open the page that calls getPrayerViaMutation with the same date and language.
Result: Frontend receives a prayer object (e.g. title "In the Stillness of Winter's Heart") with an _id and full JSON, as if a prayer existed.

Proof the WebSocket data is wrong
Use the returned _id in a delete (or any) operation that expects a prayers document.
Result: ArgumentValidationError: Found ID "..." from table \notificationSettings⁨
, which does not match the table name in validator 
, which does not match the table name in validator 
⁩v.id("prayers")⁨
. So the WebSocket is returning a document from another table, not fromprayers
. So the WebSocket is returning a document from another table, not fromprayers
⁩.

Minimal code (mutation that shows the mismatch):

export const getPrayerViaMutation = mutation({
args: {
language: v.union(v.literal("en"), v.literal("es"), v.literal("fr"), v.literal("pt")),
date: v.string(),
},
handler: async (ctx, args) => {
const prayer = await ctx.db
.query("prayers")
.withIndex("by_language_and_date", (q) =>
q.eq("language", args.language).eq("date", args.date)
)
.order("desc")
.first();
return prayer;
},
});
Same mutation: correct result via CLI, wrong (phantom/cross-table) result via WebSocket.

4. Network test
(Ran against my DEV deployment; same Convex infrastructure. All checks passed.)

- Performing network test...
✔ Deployment URL: [REDACTED - per forum guidelines]
✔ OK: DNS lookup => 52.44.230.118:ipv4 (86.96ms)
✔ OK: TCP connect (24.51ms)
✔ OK: TCP connect (21.98ms)
✔ OK: HTTP check (35.73ms)
✔ OK: HTTPS check (60.43ms)
✔ OK: WebSocket connection established.
✔ OK: echo 128 B (16.98ms, 7.4 KB/s)
✔ OK: echo 4.0 MB (711.45ms, 5.6 MB/s)
✔ Network test passed.

5. What I’d like
WebSocket responses should match CLI for the same deployment and same function: return the actual document from the database or null when none exists, and never return a document from a different table.

Account verified – you can check my deployment logs if needed.

Thanks in advance for your help!
Convex Community banner
Convex CommunityJoin
Join the Convex Discord! Explore Convex, the backend platform that keeps your app in sync.
15,138Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
james

Hi @everyone with everything going on today I forgot to post on discord about our EU launch! We have a region in Dublin now! You can start using it immediately, even for folks on the free plan. https://news.convex.dev/we-finally-got-our-eu-visa/ Stay tuned for more regions but also stay tuned for more infra improvements where we improve latency for teams no matter where their servers are located. Just at the tip of the iceberg re all the optimizations we have lined up.

james · 4d ago

Wayne

Hi @everyone happy Monday. Components Authoring [Challenge](https://www.convex.dev/components/challenge) updates! Meet the second batch of community-approved components **Firecrawl Scrape **- Scrape any URL and get clean markdown, HTML, screenshots, or structured JSON - with durable caching and reactive queries. https://www.convex.dev/components/firecrawl-scrape Built by: Gitmaxd **Durable Agents **- A Convex component for building durable AI agents with an async tool loop. https://www.convex.dev/components/durable-agents Built by: Siegfried **Convex Debouncer** - A server-side debouncing component for debouncing expensive operations like LLM calls, metrics computation, or any heavy processing that should only run after a period of inactivity. https://www.convex.dev/components/debouncer Built by: Ilya **DatabaseChat **- A Convex component for adding natural language database queries to your app. https://www.convex.dev/components/database-chat Built by: Nick **Transloadit** - A Convex component for creating Transloadit Assemblies, handling resumable uploads with status, and persisting status/results in Convex. https://www.convex.dev/components/transloadit Built by: Kvz **Loops** - A Convex component for integrating with Loops.so email marketing platform. https://www.convex.dev/components/loops Built by: Bobby The [challenge](https://www.convex.dev/components/challenge) is now ongoing, so keep building, and we'll keep rewarding. Thanks, everyone!

Wayne · 3w ago

Liz C

Hi everyone! Have you ever wanted to get your hands on some convex swag? Well you're in luck! We just launched our Convex swag store. Check it out here ---> https://store.convex.dev/

Liz C · 3w ago

Similar Threads

batchCount doesn't seem to exist in aggregate?
AboudAAboud / support-community
5mo ago
Storing generated audio file doesn't work in action. Same code works fine in HTTP action.
DegiDDegi / support-community
13mo ago
Extend/Pick/Omit validators doesn't exist
ŠtosdenferŠŠtosdenfer / support-community
3mo ago
deployment/prod environment doesn't replicate dev data
RicardoGEstevesRRicardoGEsteves / support-community
2y ago