You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Next.js 13.3.0 along with version 0.17.0 of the next-axiom library to handle API routing in my application. I have created an intermediate logger using req.log.with to customize the logs in my API endpoint handlers. However, I am experiencing an issue where responses are not sent correctly and warnings are generated in the console.
The issue seems to be related to the use of req.log.with, as when I use it, responses are not sent correctly and requests are left hanging, resulting in the following warning in the console:
"API resolved without sending a response for /api/[endpoint], this may result in stalled requests."
This issue only occurs when I use req.log.with, as if I only use req.log.info for logging, no warnings are generated and responses are sent correctly.
I have found a workaround by adding the following config object to my API route:
This seems to resolve the issue, but I'm not sure if it's the proper implementation or not, as there is no information available in the documentation of next-axiom.
Here are the versions I am using:
Next.js: 13.3.0
next-axiom: 0.17.0
Steps to reproduce the issue:
Create an intermediate logger using req.log.with in an API endpoint handler in Next.js.
Make a request to that endpoint from a client.
Observe that the response is not sent correctly and warnings are generated in the console.
Hey @nikosantis, sorry for getting back so late -- from a quick look I'm surprised that with would introduce these problems, I'll try to reproduce using your code, thanks for bringing this issue to our attention 🙏
this also assigns the default logger to be use to the parent logger of that actor logger (since withAxiomNextApiHandler is creating its own Logger that is not the same as/child from the log exported by the package). If I remove the motherLog.with and just return the original logger I do not get the warning: "API resolved without sending a response for /api/[endpoint], this may result in stalled requests."
I am using Next.js 13.3.0 along with version 0.17.0 of the next-axiom library to handle API routing in my application. I have created an intermediate logger using
req.log.with
to customize the logs in my API endpoint handlers. However, I am experiencing an issue where responses are not sent correctly and warnings are generated in the console.The issue seems to be related to the use of req.log.with, as when I use it, responses are not sent correctly and requests are left hanging, resulting in the following warning in the console:
"API resolved without sending a response for /api/[endpoint], this may result in stalled requests."
This issue only occurs when I use
req.log.with
, as if I only use req.log.info for logging, no warnings are generated and responses are sent correctly.I have found a workaround by adding the following config object to my API route:
This seems to resolve the issue, but I'm not sure if it's the proper implementation or not, as there is no information available in the documentation of
next-axiom
.Here are the versions I am using:
Next.js: 13.3.0
next-axiom: 0.17.0
Steps to reproduce the issue:
Create an intermediate logger using
req.log.with
in an API endpoint handler in Next.js.Make a request to that endpoint from a client.
Observe that the response is not sent correctly and warnings are generated in the console.
eg:
I was trying to create a function
createLogger
:eg:
The text was updated successfully, but these errors were encountered: