ReferenceError: Cannot access 'ManagementError' before initialization

オープン
#1,434 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript
領域
backend, devtools

調査の方向性

Start with the generated ManagementTimeoutError.ts and the errors barrel it imports, then check how Fern generates this file and how the ESM build is produced. Reproduce the import failure without creating an Auth0 client or making a network request. Done when the generated error imports ManagementError directly, the cycle is removed, and importing the ESM build succeeds while public exports remain intact.

索引モデルが issue の本文から書いたものです。

説明

bug
Checklist
  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.
Description

ESM import can access ManagementError before initialization

Summary

Importing the ESM build can fail during module initialization with:

ReferenceError: Cannot access 'ManagementError' before initialization
    at .../auth0/dist/esm/management/errors/ManagementTimeoutError.mjs:3:52

The failure occurs before an Auth0 client is instantiated or a network request is made, so no Auth0 credentials are required to investigate it.

Suspected cause

ManagementTimeoutError imports the errors barrel and extends its ManagementError export:

import * as errors from "./index.js";

export class ManagementTimeoutError extends errors.ManagementError {}

The barrel also exports ManagementTimeoutError, producing this cycle:

ManagementTimeoutError -> errors/index -> ManagementTimeoutError

Proposed generator change

Generate a direct dependency on the base error instead:

import { ManagementError } from "./ManagementError.js";

export class ManagementTimeoutError extends ManagementError {}

This removes the error module's barrel cycle while preserving the package's public exports.

Notes for maintainers

ManagementTimeoutError.ts is generated by Fern so I didn't create a PR in this repo for it, not sure how that is typically handled.

Reproduction

I ran into this with a simple import in an ESM project -- happy to create a repro repository if needed.

Additional context

No response

node-auth0 version

7.6.0

Node.js version

26.12

主要言語
TypeScript
スター
683
フォーク
319
平均マージ
1日 30分
マージ済み PR(30日)
13

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

auth0/node-auth0 のほかの issue

auth0/node-auth0 の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。