Skip to content

Fix/772 async hooks esm logging#812

Open
xtrial01 wants to merge 2 commits into
rinafcode:mainfrom
xtrial01:fix/772-async-hooks-esm-logging
Open

Fix/772 async hooks esm logging#812
xtrial01 wants to merge 2 commits into
rinafcode:mainfrom
xtrial01:fix/772-async-hooks-esm-logging

Conversation

@xtrial01

Copy link
Copy Markdown

Summary

Fixes #772

Replaces the incompatible require('node:async_hooks') call with a
top-level ESM import statement in src/lib/logging/index.ts.

Changes

  • src/lib/logging/index.ts — swapped require() for ESM-compatible import

Why

Next.js 15 runs as native ESM (type: module), where require() is
not defined. This caused a ReferenceError at startup, breaking
async-context-based request correlation.

Testing

  • No conflict markers or debug code in changed file
  • Diff against main confirms only the intended change is included
  • CI pipeline will run tests and linting on this PR

xtrial01 added 2 commits June 28, 2026 13:18
…hooks

- Replace require('node:async_hooks') with top-level ESM import
- Fixes ReferenceError: require is not defined in Next.js 15 ESM context
- Maintains fallback behavior for environments without async context support

Closes rinafcode#772
@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@xtrial01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Successfully merging this pull request may close these issues.

[Refactor] async_hooks loaded via require() in ESM logging module — incompatible at runtime

1 participant