Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodejs process crashed when using console to print some object. TypeError: Cannot read properties of undefined (reading 'reloadNavigation') #52887

Open
zyh825 opened this issue May 8, 2024 · 2 comments

Comments

@zyh825
Copy link

zyh825 commented May 8, 2024

Version

v20.13.0

Platform

Darwin zhangyuhangdeMacBook-Pro.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:19:22 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8112 arm64

Subsystem

No response

What steps will reproduce the bug?

import { serve } from '@hono/node-server';
import { Hono } from 'hono';

import { polyfillHandler } from './polyfill-handler.js';

const app = new Hono();

app.get('*', async (c) => {
  // console.log(c.env); // ok
  // console.log(c.res); // ok
  // console.log(c.req); // crashed here !!!!!
  // console.log(c.req.header('User-Agent')); // ok
  // console.log(c.req.path); // ok
  // console.log(c.req.url); // ok

  if (/\/polyfill(\.min)?\.js$/.test(c.req.path)) {
    return polyfillHandler(c);
  }
  c.res.headers.set(
    'Cache-Control',
    'public, s-maxage=31536000, max-age=604800, stale-while-revalidate=604800, stale-if-error=604800, immutable'
  );
  return c.text('Not Found', 404);
});

The reproduce code & some cases is show above。
print a deep value is still work,like c.req.url

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

No response

What do you see instead?

This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

at Function.fail (node:internal/assert:20:9)
at handleMaxCallStackSize (node:internal/util/inspect:1556:10)
at formatRaw (node:internal/util/inspect:1062:12)
at formatValue (node:internal/util/inspect:840:10)
at formatProperty (node:internal/util/inspect:1945:11)
at formatRaw (node:internal/util/inspect:1054:9)
at formatValue (node:internal/util/inspect:840:10)
at inspect (node:internal/util/inspect:364:10)
at formatWithOptionsInternal (node:internal/util/inspect:2298:40)
at formatWithOptions (node:internal/util/inspect:2160:10)

Additional information

No response

@marco-ippolito marco-ippolito changed the title Nodejs process crashed when using cosnole to print some object. TypeError: Cannot read properties of undefined (reading 'reloadNavigation') Nodejs process crashed when using console to print some object. TypeError: Cannot read properties of undefined (reading 'reloadNavigation') May 8, 2024
@marco-ippolito
Copy link
Member

Thanks for the report, would you be able to provide a repro without 3rd party dependencies?

@zyh825
Copy link
Author

zyh825 commented May 8, 2024

https://github.com/zyh825/polyfill-service
Cause i don't known how this crash work, Here the demo project with 3rd party dependencies.
Hope it helps。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants