filecoin-project / filecoin-project/filecoin-pin

DEP0205 module.register() deprecation warning on Node 24+ from @sentry/node telemetry init

Open
#602 0 comments 0 reactions 0 assignees View on GitHub
bug dependencies team/filecoin-pin team/fs-wg
Dominant language
TypeScript
Stars
26
Forks
21
Avg merge
5d 18h
Merged PRs (30d)
27

Description

## Description

Running most `filecoin-pin` commands on Node 24+ prints a deprecation warning to stderr:

```
(node:61792) [DEP0205] DeprecationWarning: `module.register()` is deprecated. Use `module.registerHooks()` instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
```

It's cosmetic (nothing breaks), but it's noise on every real invocation and looks like our bug.

## Root cause

`src/instrument.ts` calls `Sentry.init()`, imported first in `src/cli.ts`. `Sentry.init()` runs `@sentry/node-core`'s `initializeEsmLoader()`, which calls `module.register('import-in-the-middle/hook.mjs', ...)` to install the `import-in-the-middle` ESM hook. Node 24+ deprecated `module.register()` in favor of `module.registerHooks()` (DEP0205), so the warning fires.

Stack trace (`node --trace-deprecation dist/cli.js payments status`):

```
at Module.register (node:internal/modules/esm/loader)
at initializeEsmLoader (.../@sentry/node-core/build/esm/sdk/esmLoader.js:23)
at _init (.../@sentry/node-core/build/esm/sdk/index.js:90)
at init (.../@sentry/node/build/esm/sdk/index.js:36)
at .../dist/instrument.js:4
```

Versions: `@sentry/node@10.49.0`, Node v26.2.0.

## Upstream status

This is two layers deep and not actionable for us beyond a dependency bump:

- Sentry tracks it in getsentry/sentry-javascript#20810 (open, no assignee or linked PR as of 2026-06-29).
- Sentry calls `module.register()` only to install nodejs/import-in-the-middle's hook, so it can't migrate until `import-in-the-middle` supports `module.registerHooks()`. No issue/PR for that migration there yet.
- Node's `registerHooks()` is still stabilizing (nodejs/node#56241) and is not a drop-in swap, the timing semantics for hooking static imports differ.

Plan: bump `@sentry/node` once the migration lands upstream, then this clears on its own.

## Notes

- `FILECOIN_PIN_TELEMETRY_DISABLED=true` does NOT suppress it. `Sentry.init()` registers the ESM hook regardless of `enabled`.
- Only shows on commands that stay alive (e.g. `payments status`), not `--version` / `--help`, which exit before the async hook job surfaces the warning.

## Stopgap options (if the noise bothers anyone before the upstream fix)

1. `NODE_OPTIONS=--disable-warning=DEP0205` (Node 22.5+). Silences only this one warning code. Downside: it's env-only, so every user has to set it themselves, it doesn't ship in the published CLI.
2. `process.noDeprecation = true` at the top of `instrument.ts`, before `Sentry.init()`. Ships to all CLI users, one line. Downside: global off-switch, it hides every deprecation warning, including ones in our own code we'd want to catch in dev/CI.
3. A `process.on('warning', ...)` handler that drops only `DEP0205` and re-emits the rest. Surgical and ships to all users. Downside: it's a custom interceptor we own, it has to register before the async hook emits, and it takes over Node's default warning printing (we'd have to re-emit other warnings ourselves), so a bug there could silently swallow real warnings.

Leaning toward doing nothing until the upstream bump, the warning is harmless. If we act, option 1 for local noise, option 3 if we want clean output for end users without blinding ourselves to other deprecations.

## Steps to reproduce

1. Node 24+ (tested v26.2.0)
2. `node --trace-deprecation dist/cli.js payments status`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.