Real-Time Logs not showing error responses

I'm trying to debug an issue with some sporadic errors which result in a 401 api response from my pages function. When using the Real-Time Logs stream, all 200 OK responses come through but the 401 error responses do not. How can I get all api responses to show? Would it be framework specific? I'm using Nuxt3 and have logging on all requests, responses and errors through Nitro hooks api.
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('request', (event) => {
console.log('Request', event.method, event.path);
});

nitroApp.hooks.hook('beforeResponse', (event, { body }) => {
console.log('Response', event.method, event.path, { body });
});

nitroApp.hooks.hook('error', (error, { event }) => {
console.error(
`${event?.path || 'Undefined Server Event'} Application error:`,
error,
);
});
});
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('request', (event) => {
console.log('Request', event.method, event.path);
});

nitroApp.hooks.hook('beforeResponse', (event, { body }) => {
console.log('Response', event.method, event.path, { body });
});

nitroApp.hooks.hook('error', (error, { event }) => {
console.error(
`${event?.path || 'Undefined Server Event'} Application error:`,
error,
);
});
});
9 Replies
Walshy
Walshy2d ago
realtime logs has all requests
AGill
AGillOP2d ago
But I for certain don't see the logs for the error responses. Didn't apply any filters either
AGill
AGillOP2d ago
From devtools the error comes from id z4y4l3.... but it's not the CF log stream
No description
No description
AGill
AGillOP2d ago
can ignore the "refresh_token" calls, more focused devtools pic
No description
Walshy
Walshy2d ago
what's the body on the 401?
AGill
AGillOP2d ago
{
"url": "/api/reports/z4y4l3jpgmyq0luxgi9s1zuy?items=slim",
"statusCode": 401,
"statusMessage": "",
"message": "signature verification failed",
"stack": ""
}
{
"url": "/api/reports/z4y4l3jpgmyq0luxgi9s1zuy?items=slim",
"statusCode": 401,
"statusMessage": "",
"message": "signature verification failed",
"stack": ""
}
That's the error I'm trying to debug, which happens periodically
Walshy
Walshy2d ago
yeah not seeing either the tabler.json or the z4y request, wonder if too many events in short time? not fully sure
AGill
AGillOP2d ago
Heyy ok cool ~~ looks like the log just came in. But 10 minutes after:
No description
AGill
AGillOP2d ago
10:04 -> 10:14 ^ don't know why I got lucky with that request. the issue still persists. not seeing logs for the error responses. even after waiting

Did you find this page helpful?