N
Novu2w ago
hydrandt

React: Cannot read properties of undefined (reading 'split')

Hi, I'm playing with self hosted novu (docker compose) in a react app. Every time I send a notification and then try to open the inbox component, there is a crash:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'split')
at index.mjs:968:38
at DefaultNotification.createRenderEffect.e [as fn] (index.mjs:7880:17)
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'split')
at index.mjs:968:38
at DefaultNotification.createRenderEffect.e [as fn] (index.mjs:7880:17)
The crash is because the key property here is undefined:
const styleFuncMemo = createMemo(
() => ({
key,
className,
iconKey,
context
}) => {
const appearanceKeyParts = key.split("__");
...
const styleFuncMemo = createMemo(
() => ({
key,
className,
iconKey,
context
}) => {
const appearanceKeyParts = key.split("__");
...
Anyone has an idea what is causing this? When I connected to the SAAS version of Novu, I didn't have this problem. All my docker images are with version 2.3.0, and "@novu/react": "^3.10.1. Happy to debug together!:)
2 Replies
Pawan Jain
Pawan Jain2w ago
Hi

Please use 3.7.0 version or earlier
hydrandt
hydrandtOP2w ago
Awesome, thank you! It works with novu/react up to 3.8.1. Was there a change in the API that is not reflected in the publicly available docker images yet? Now a new problem!:) After viewing a notification, it can not be marked as Seen:
Failed to mark notifications as seen: Error: @novu/react@3.8.1 components error. Status: 404, Message: Cannot POST /api/v1/inbox/notifications/seen
Failed to mark notifications as seen: Error: @novu/react@3.8.1 components error. Status: 404, Message: Cannot POST /api/v1/inbox/notifications/seen
Looking into it, would be happy for any suggestions! ok, figured it out: with backend 2.3.0, the last novu/react version that can be used is 3.6.0

Did you find this page helpful?