It says "Unexpected token u" in browser error console. The "Unexpected token u" error typically occurs when you try to parse a string that is undefined or null, because the first character of undefined or null is "u".
In your code, it's possible that the lastMessageRaw variable is undefined or null, which is causing the error when you try to parse it as JSON. You can add a null check to make sure that lastMessageRaw has a value before attempting to parse it as JSON.
It says "Unexpected token u" in browser error console. The "Unexpected token u" error typically occurs when you try to parse a string that is undefined or null, because the first character of undefined or null is "u".
In your code, it's possible that the lastMessageRaw variable is undefined or null, which is causing the error when you try to parse it as JSON. You can add a null check to make sure that lastMessageRaw has a value before attempting to parse it as JSON.
https://github.com/joschan21/nextjs-realtime-chat/blob/78057985c9cb588afb3745fa52ece5c435dcd075/src/app/(dashboard)/dashboard/page.tsx#L19-L31