Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Deleting the last message in a conversation will prompt failure #81

Open
qmarliu opened this issue Nov 3, 2024 · 2 comments
Open

Comments

@qmarliu
Copy link

qmarliu commented Nov 3, 2024

OpenIM Server Version

3.8.0

Operating System and CPU Architecture

macOS (ARM)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

  1. user A send a msg to user B
  2. delete last msg
  3. then will get a error msg: SDK => [OperationID:77de3158-7172-4013-a297-19bc01fd5d5f] (invoked by js) run deleteMessage with error {"errCode":10005,"errMsg":"error *errors.withStack not implement CodeError: ==> github.com/openimsdk/openim-sdk-core/v3/pkg/utils.JsonStringToStruct()@79: json Unmarshal failed: json: Unmarshal(non-pointer []*model_struct.LocalChatLog)","operationID":"77de3158-7172-4013-a297-19bc01fd5d5f"}

Screenshots Link

image

@Bloomingg
Copy link
Member

Perhaps you can update your sdk (npm latest) and server (3.8.1) to the latest version and try again. I didn't encounter this problem in my test.

@qmarliu
Copy link
Author

qmarliu commented Nov 5, 2024

I fixed this one.
in the openim-sdk-core. GetLatestActiveMessage methods call "utils.JsonStringToStruct(v, result)" should change to "utils.JsonStringToStruct(v, &result)". missing &

func (i *LocalChatLogs) GetLatestActiveMessage(ctx context.Context, conversationID string, isReverse bool) (result []*model_struct.LocalChatLog, err error) {
msg, err := exec.Exec(conversationID, isReverse)
if err != nil {
return nil, err
} else {
if v, ok := msg.(string); ok {
err := utils.JsonStringToStruct(v, result) // error line
if err != nil {
return nil, err
}

		return result, err
	} else {
		return nil, exec.ErrType
	}
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants