-
Notifications
You must be signed in to change notification settings - Fork 409
Open
Labels
bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
OpenIM SDK Version
@openim/client-sdk@3.8.3
OpenIM Server Version
No response
SDK Platform
Web WASM SDK
Device Model
MacBook Pro (Apple Silicon)
Operating System Version
macOS 15.x
Bug Description and Steps to Reproduce
Web SDK First Message Failure in Fresh Browser Session (errCode=10006)
Summary
In a fresh browser session (new browser profile / incognito), the first message send may fail in OpenIM Web SDK with:
errCode: 10006errMsg: Cannot read properties of undefined (reading 'si_<recvID>_<userID>')
App-side symptom: message send fails with a generic "unknown error".
Environment
- SDK:
@openim/client-sdk@3.8.3 - Runtime: Browser (Vite dev environment)
- Scenario: First login + first send in a fresh browser session
Reproduction Steps
- Open app in a fresh browser profile (or incognito window).
- Login with a valid user token and wait for SDK connect/sync events.
- Open a single-chat conversation page.
- Send the first text message.
Actual Result
First send fails with SDK internal error:
(event) GetOneConversation error:
Cannot read properties of undefined (reading 'si_<target>_<user>')
errCode: 10006
(event) SendMessage error:
Cannot read properties of undefined (reading 'si_<target>_<user>')
errCode: 10006
Expected Result
The first message in a fresh session should be sent successfully without requiring manual refresh or retries.
Logs (Key Snippets)
SDK => (invoked) run getOneConversation ...
SDK => (response) run getOneConversation with error {
"event":"GetOneConversation",
"errCode":10006,
"errMsg":"Cannot read properties of undefined (reading 'si_...')"
}
SDK => (invoked) run sendMessage ...
SDK => (response) run sendMessage with error {
"event":"SendMessage",
"errCode":10006,
"errMsg":"Cannot read properties of undefined (reading 'si_...')"
}
Suspected Root Cause
From Web SDK runtime behavior:
- In empty-conversation startup path,
cachedHasReadAndMaxSeqsmay becomeundefined. - Later reads like
cachedHasReadAndMaxSeqs[conversationID]hitundefined['si_*']. sendMessage/sendMessageNotOsspre-send depends ongetOneConversationAndTryChange; when this fails with10006, send flow aborts instead of degrading to init-and-send path.
Local Patch (Validated)
The following local patch consistently fixed the issue in repeated fresh-session tests:
-
Defensive fallback for seq cache
cachedHasReadAndMaxSeqs = seqs || {}- getter fallback:
cachedHasReadAndMaxSeqs || (cachedHasReadAndMaxSeqs = {})
-
Degrade in pre-send conversation fetch
- In
sendMessage/sendMessageNotOss, do not abort sending when pre-sendgetOneConversationAndTryChange(...)fails in cold-start edge case.
- In
After patch:
- First send succeeds in fresh browser session
- No
si_*undefined error chain - No app-level generic send failure
Notes
I can provide a clean PR against upstream if maintainers agree with this fix direction.
Screenshots Link
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.