N
Novu4d ago
Dara

Error with `subscribers/{subscriberId}/messages/mark-all`

I'm using Novu Framework with Express and tried to test an endpoint locally that uses the novu.subscribers.markAllMessagesAs(). I tried marking all the messages as "read", but I got a 500 status code in the response with a server error message. All my other endpoints work. Local environment: MacOS 15.3.1 24 GB RAM npm v10.9.0 Node v23.3.0 ngrok to expose bridge endpoint The error says to reach out to support and give them the errorId: "ed7a58b8f29642a5b14ba1c691b6307d" Thanks for your help!
No description
No description
No description
5 Replies
Pawan Jain
Pawan Jain4d ago
@Dara Its a bit strange, you are using this method, novu.subscribers.markAllMessagesAs() but in first screenshot, api is different by any chance, you are calling markMessageRead method instead?
Dara
DaraOP3d ago
I got it to work, but I am not sure why my solution works. I have another endpoint that is calls markMessageRead, but I was not testing that one. But when I commented it out, the markAllMessagesAs endpoint worked in Postman. Maybe it has to do with how I've defined the endpoints in my API? markMessageRead: "/api/subscribers/:id/messages/:messageId" markAllMessagesAs: "api/subscribers/:id/messages/mark-all" Any light you can shed on this would be appreciated!
No description
Dara
DaraOP3d ago
OK, when I have the code for the markAllMessagesAs endpoint BEFORE the markMessageRead endpoint in server.ts, it works. I have no idea why.
No description
Pawan Jain
Pawan Jain3d ago
@Dara It is related to how express handles api routes. I think it is not related to novu
Dara
DaraOP3d ago
It would seem so. Thanks.

Did you find this page helpful?