Skip to content

Missing .stack value on node 21 #302

@kanongil

Description

@kanongil

Support plan

  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: v21.1.0
  • module version with issue: 10.0.1
  • last module version without issue:
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

This issue is caused by a V8 engine upgrade that changes the behaviour of Hoek.clone(). A fix is proposed in: hapijs/hoek#390

What are you trying to achieve or the steps to reproduce?

const error = new Error("fail");
const boom = Boom.badImplementation(error);

assert.equal(boom.stack, error.stack);

What was the result you got?

Uncaught AssertionError [ERR_ASSERTION]: undefined == 'Error: fail\n' +
  '    at REPL2:1:15\n' +
  '    at ContextifyScript.runInThisContext (node:vm:121:12)\n' +
  '    at REPLServer.defaultEval (node:repl:599:22)\n' +
  '    at bound (node:domain:432:15)\n' +
  '    at REPLServer.runBound [as eval] (node:domain:443:12)\n' +
  '    at REPLServer.onLine (node:repl:929:10)\n' +
  '    at REPLServer.emit (node:events:527:35)\n' +
  '    at REPLServer.emit (node:domain:488:12)\n' +
  '    at [_onLine] [as _onLine] (node:internal/readline/interface:416:12)\n' ...
    at REPL5:1:8
    at ContextifyScript.runInThisContext (node:vm:121:12)
    at REPLServer.defaultEval (node:repl:599:22)
    at bound (node:domain:432:15)
    at REPLServer.runBound [as eval] (node:domain:443:12)
    at REPLServer.onLine (node:repl:929:10)
    at REPLServer.emit (node:events:527:35)
    at REPLServer.emit (node:domain:488:12)
    at [_onLine] [as _onLine] (node:internal/readline/interface:416:12)
    at [_line] [as _line] (node:internal/readline/interface:887:18) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: 'Error: fail\n' +
    '    at REPL2:1:15\n' +
    '    at ContextifyScript.runInThisContext (node:vm:121:12)\n' +
    '    at REPLServer.defaultEval (node:repl:599:22)\n' +
    '    at bound (node:domain:432:15)\n' +
    '    at REPLServer.runBound [as eval] (node:domain:443:12)\n' +
    '    at REPLServer.onLine (node:repl:929:10)\n' +
    '    at REPLServer.emit (node:events:527:35)\n' +
    '    at REPLServer.emit (node:domain:488:12)\n' +
    '    at [_onLine] [as _onLine] (node:internal/readline/interface:416:12)\n' +
    '...',
  operator: '=='

What result did you expect?

No assertion error, as on node v20.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug or defect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions