Closed AndrewSB closed 1 year ago
Hey @AndrewSB,
Thanks for reporting this. Moving it to our low-level client repo, since the issue is there. We will analyze it and get back to you when we have an update.
In the meantime, deleting the message or sending new ones to the channel should solve it for that particular channel.
Best, Martin
Hi @AndrewSB , we believe to have found the issue, which is fixed here: https://github.com/GetStream/stream-chat-swift/pull/2258 Could you give it a try and let us know if it works?
Hi!
This issue is now solved in the 4.21.1 release.
Thank you for your patience!
Best, Nuno
Hey! we just tested with the new version and it looks like the problem is actually worse, now we see this more often even when .isLocalStorage = false
I can get some logs for you sometime tomorrow, maybe the underlying issue wasn't https://github.com/GetStream/stream-chat-swift/pull/2258
Hi @AndrewSB,
Just clarify, for this to happen, the 25 message needs to fail right?
Yes, logs would be nice very helpful.
We will re-open the issue then and resume the investigation, sorry for the inconvenience.
Best, Nuno
so it looks like the logs i see both when i open the channel, and when i scroll to the top are
2022-09-08 13:37:57.892 [ERROR] [main] [ChannelController.swift:741] [loadPreviousMessages(before:limit:completion:)] > You can't load new messages when there is no messages in the channel.
repeated many times
let me see if i can get more details.
i think i understand the bug, it seems like incorrect state in the ChannelController somehow.
on ChannelController.swift:741, both messageId
and lastFetchedMessageId
are nil, so it's never able to load any previous messages
this is on release 4.21.1. let me try the latest to see if it's any different
there must be an edge case that was missed in https://github.com/GetStream/stream-chat-swift/pull/2258
let me know how i can help to solve this
Hi @AndrewSB. Could you please let us know what's the flow that leads to calling loadPreviousMessages
for you? You should have called synchronize
before, that should have set a value for lastFetchedMessageId
. We're investigating it.
We have created a branch for you to test: https://github.com/GetStream/stream-chat-swift/pull/2279
But we believe there can be something you are doing within your flow that's not following the expected order (synchronize
-> loadPreviousMessages
). It is looks like you were only fetching from DB. Please give us some more context so we are sure we are solving the issue for you
@martinmitrevski i think this might be related to that workaround we did to prevent being booted out of a chat thread
this is how we create a channel destination, i don't believe its synchronized in the solution we came up with together
going to try doing a chatController.synchronize()
right before we return the ChatThreadView
ok, still doesn't work, but now what i see is a bunch of
2022-09-09 19:19:58.709 [ERROR] [com.apple.NSURLSession-delegate] [RequestDecoder.swift:67] [decodeRequestResponse(data:response:error:)] > API request failed with status code: 429, code: 9 response:
{
"code" : 9,
"message" : "GetOrCreateChannel failed with error: \"Too many requests for user: 5cb05d045b81370e679a1fcb, check response headers for more information.\"",
"more_info" : "https:\/\/getstream.io\/chat\/docs\/api_errors_response",
"details" : [
],
"StatusCode" : 429,
"duration" : ""
})
and i no longer get the
2022-09-08 13:37:57.892 [ERROR] [main] [ChannelController.swift:741] [loadPreviousMessages(before:limit:completion:)] > You can't load new messages when there is no messages in the channel.
logs
going to try your bugfix/pagination-edge-case
branch now
hey @AndrewSB,
I don't think that's the problem, since syncronize
is also called in the view model, so I guess the error you get is because you call it too many times.
Please let us know how the branch works for you. If it doesn't help, we can have a call early next week to go through your issue.
Best, Martin
yeah, i think this branch is working. @martinmitrevski can we whatever fix that is patched into the main version?
hey @AndrewSB, this is merged in the develop
branch in our StreamChat
repo. This week there's no release planned, so you can use it in the SwiftUI SDK by creating a branch pointing to StreamChat
's develop
branch.
hey! we had this working on https://github.com/GetStream/stream-chat-swift/commit/9a39117a4677254a85464dbdcd4a4f4354e9792d, but after updating to https://github.com/GetStream/stream-chat-swift/commit/88f325da010642aa0e15452a1518164458d25190 it looks like the problem has re-appeared
HI @AndrewSB!
You are seeing again the "You can't load new messages when there are no messages in the channel." error log?
It is weird, that commit does not change anything related to this, theoretically at least.
Best, Nuno
yup! sorry for the delay, got caught up with some other work
i just tested on https://github.com/GetStream/stream-chat-swift/commit/e729ddecab8424d0eb1b6e7f874dcd88a27c1b23, and i'm seeing those logs
2022-09-22 16:13:42.256 [ERROR] [main] [ChannelController.swift:741] [loadPreviousMessages(before:limit:completion:)] > You can't load new messages when there is no messages in the channel.
2022-09-22 16:13:42.280 [ERROR] [main] [ChannelController.swift:741] [loadPreviousMessages(before:limit:completion:)] > You can't load new messages when there is no messages in the channel.
2022-09-22 16:13:42.280 [ERROR] [main] [ChannelController.swift:741] [loadPreviousMessages(before:limit:completion:)] > You can't load new messages when there is no messages in the channel.
2022-09-22 16:13:42.280 [ERROR] [main] [ChannelController.swift:741] [loadPreviousMessages(before:limit:completion:)] > You can't load new messages when there is no messages in the channel.
2022-09-22 16:13:42.299 [ERROR] [main] [ChannelController.swift:741] [loadPreviousMessages(before:limit:completion:)] > You can't load new messages when there is no messages in the channel.
2022-09-22 16:13:42.299 [ERROR] [main] [ChannelController.swift:741] [loadPreviousMessages(before:limit:completion:)] > You can't load new messages when there is no messages in the channel.
2022-09-22 16:13:42.314 [ERROR] [main] [ChannelController.swift:741] [loadPreviousMessages(before:limit:completion:)] > You can't load new messages when there is no messages in the channel.
testing with the latest now, just to make sure you haven't fixed it in the last 3 days (checking out https://github.com/GetStream/stream-chat-swift/commit/e6c14c8b05abf4024898cd78ee72303fa6def61f)
it seems to work on the latest commit. was there a change that was made that you expected to fix it with? i'm wary of removing my version pin unless you believe you've made a change that actually solves this
The changes you are interested in should be the ones added in https://github.com/GetStream/stream-chat-swift/commit/233455651bb239c255f56f6f74d83fd4ba9a1a65 (PR: https://github.com/GetStream/stream-chat-swift/pull/2298)
ahh awesome, cool. i think this is safe to close for now. we'll pin to that commit and take the next release that comes out. thanks @polqf!
Happy to hear that @AndrewSB 😄
What did you do?
tried to scroll to the top of a channel, to see my older messages
What did you expect to happen?
being able to scroll all the way to the beginning of a thread
What happened instead?
instead, parts of my history were unavailable, i couldn't scroll back past a point
I see the following logs as i scroll to the top of the channel :
the oldest message being displayed in the channel is a message that failed to send, my guess is the SDK encounters this message that's failed to send, requests it from the server, receives an error and then stops fetching older messages for some reason.
not sure if this should be here or in the low level SDK