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
> messageOrError.stack
'AssertionError [ERR_ASSERTION]: Hello World
at handler (/home/stefan/[redacted]/src/index.ts:26:9)
at exports.Manager.execute (/home/stefan/[redacted]/node_modules/@hapi/hapi/lib/toolkit.js:57:29)
at internals.handler (/home/stefan/[redacted]/node_modules/@hapi/hapi/lib/handler.js:46:48)
at exports.execute (/home/stefan/[redacted]/node_modules/@hapi/hapi/lib/handler.js:31:36)
at Request._lifecycle (/home/stefan/[redacted]/node_modules/@hapi/hapi/lib/request.js:370:68)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Request._execute (/home/stefan/[redacted]/node_modules/@hapi/hapi/lib/request.js:280:9)'
> Hoek.clone(messageOrError).stack
undefined
Thanks for the report. This is a known issue with Hoek.clone() and node v21+. I have proposed a fix in hapijs/hoek#390, and made an issue against hapi in #4519.
Until this is fixed, I would suggest you use node 20 for running hapi.
Runtime
node.js
Runtime version
22.9.0
Module version
@hapi/[email protected]
Last module version without issue
unknown
Used with
standalone
Any other relevant information
When throwing an unhandled exception, the stack is available in the boom object in
onPreResponse
, but not for "system" exceptions likeAssertionError
Culprit:
hapi/lib/toolkit.js
Line 64 in 22377ee
The error is passed as
message
instead ofdata
https://github.com/hapijs/boom/blob/01a4996dc6e62949aa7a98ca75b2d0dcd8a4a0a8/lib/index.js#L74
Boom catches it as error, but
Hoek.clone
loses the stack trace ❗https://github.com/hapijs/hoek/blob/0f0a14eae94d28b4826e3bb4b2071b4eccbd398f/lib/clone.js#L91-L94
when
key === 'stack'
, thedescriptor
is retrieved and applied tonewObj
, butdescriptor.get()
isundefined
What are you trying to achieve or the steps to reproduce?
What was the result you got?
What result did you expect?
The text was updated successfully, but these errors were encountered: