N
Novu2mo ago
Eden

Payload.data isn't passed to FE

Hey novu! i posted about a week ago about not being able to pass custom data from my action to the notification center, and after a great Pull-Reqeust from @Paweł T. and the help of @Pawan Jain i thought the issue was fixed with a new version, but after testing (with the code below) my issue seems to persist. Here's my simple setup:
await step.inApp(
'send-mention-notification',
async () => {

return {
body: jsonDocument,
subject: controls.subject ?? `${mentionedByName} mentioned you in a comment`,
data: {
url: getCommentUrl(comment.url ?? '', comment.id),
},
};
},
{
skip: async () => shouldSkipMentionWorkflow(payload),
},
);
},


<Inbox
applicationIdentifier={novuApplicationIdentifier}
subscriberId={userId}
appearance={appearance}
renderNotification={(notification) => {
console.log('Notification received', JSON.stringify(notification));
return (
<div>
<h3>{notification.subject}</h3>
<p>{notification.body}</p>
</div>
);
}}
/>
await step.inApp(
'send-mention-notification',
async () => {

return {
body: jsonDocument,
subject: controls.subject ?? `${mentionedByName} mentioned you in a comment`,
data: {
url: getCommentUrl(comment.url ?? '', comment.id),
},
};
},
{
skip: async () => shouldSkipMentionWorkflow(payload),
},
);
},


<Inbox
applicationIdentifier={novuApplicationIdentifier}
subscriberId={userId}
appearance={appearance}
renderNotification={(notification) => {
console.log('Notification received', JSON.stringify(notification));
return (
<div>
<h3>{notification.subject}</h3>
<p>{notification.body}</p>
</div>
);
}}
/>
And here's my FE console.log:
Notification received {"notification":
{
"notification":{
"id":"66d598377b008e3d36f88668",
"subject":"Eden Lender mentioned you in a comment",
"body":"wow let's go Totally different person Another Person Eden Lender",
"to":{
"id":"66bca3ac9314a600ef264457",
"subscriberId":"607a88f8-bfc4-4675-83c6-f1a9894cd797"
},
"isRead":true,
"isArchived":false,
"createdAt":"2024-09-02T10:49:27.551Z",
"readAt":"2024-09-02T10:49:33.945Z",
"channelType":"in_app",
"tags":[

]
}
}
Notification received {"notification":
{
"notification":{
"id":"66d598377b008e3d36f88668",
"subject":"Eden Lender mentioned you in a comment",
"body":"wow let's go Totally different person Another Person Eden Lender",
"to":{
"id":"66bca3ac9314a600ef264457",
"subscriberId":"607a88f8-bfc4-4675-83c6-f1a9894cd797"
},
"isRead":true,
"isArchived":false,
"createdAt":"2024-09-02T10:49:27.551Z",
"readAt":"2024-09-02T10:49:33.945Z",
"channelType":"in_app",
"tags":[

]
}
}
I'd love some help with this since it's preventing us from going to production with the dependant feature and also prevents us from using the business tier. Thank you so much 🙏
12 Replies
Pawan Jain
Pawan Jain2mo ago
@Eden I am looking into this 🙂 @Eden Could you please test with 2.0.0-canary.3 version of @novu/react
Eden
Eden2mo ago
I am using: "@novu/react": "^2.0.0-canary.3", Just tested again and made sure i have the correct version
Novu_Bot
Novu_Bot2mo ago
@Eden, you just advanced to level 2!
Pawan Jain
Pawan Jain2mo ago
data field is not there in Notification ?
Pawan Jain
Pawan Jain2mo ago
Eden
Eden2mo ago
Unfortunately not, what can i do to debug this, is there any more information i can provide to help you?
No description
Eden
Eden2mo ago
return {
body: jsonDocument,
subject: controls.subject ?? `${mentionedByName} mentioned you in a comment`,
data: {
someParam: 'someValue',
url: addCommentId(comment.url ?? '', comment.id),
},
};
return {
body: jsonDocument,
subject: controls.subject ?? `${mentionedByName} mentioned you in a comment`,
data: {
someParam: 'someValue',
url: addCommentId(comment.url ?? '', comment.id),
},
};
I even added some hard coded params in my
inApp()
inApp()
workflow
Pawan Jain
Pawan Jain2mo ago
May be just double check the versions of both @novu/framework and @novu/react
Eden
Eden2mo ago
from Fe package.json:
"@novu/framework": "^2.0.0",
from service package.json:
"@novu/react": "2.0.0-canary.3",
from Fe package.json:
"@novu/framework": "^2.0.0",
from service package.json:
"@novu/react": "2.0.0-canary.3",
Pawan Jain
Pawan Jain2mo ago
@Eden sent you a message
turtles
turtles5w ago
Hey any update on this? I'm having the same issues, no data in the notification payload
Pawan Jain
Pawan Jain4w ago
@turtles This issue was fixed for Eden. He deleted node_modules and installed latest versions
Want results from more Discord servers?
Add your server