bug: RBAC loader logs "plugin found but failed to load" when @triggerdotdev/plugins is simply not installed

Aperta Adatta ai principianti
#5,083 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@itsfaryal ci sta già lavorando.

Dal 28/10/2026.

  • #5102 di @cocvn157 — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
authorization

Direzione di ricerca

Inizia in internal-packages/rbac/src/index.ts intorno alle righe 167-209, dove il messaggio ERR_MODULE_NOT_FOUND viene confrontato con @triggerdotdev/plugins/rbac per decidere se manca il plugin stesso. Riproduci la forma del messaggio tentando un import dinamico di un pacchetto non installato in Node, poi amplia il controllo del plugin mancante in modo che corrisponda anche al nome del pacchetto tra virgolette, mantenendo rumoroso un plugin installato rotto. Applica la stessa modifica ai loader in internal-packages/sso/src/index.ts (righe 60-93) e internal-packages/billing/src/index.ts (riga 78); fatto quando tutti e tre restano silenziosi per un pacchetto assente ma registrano ancora l’errore per uno presente ma rotto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Provide environment information

Self-hosted, official Helm chart 4.8.1 (image ghcr.io/triggerdotdev/trigger.dev:v4.8.1) on Kubernetes 1.35. The plugins package is not installed, which is the normal state for a self-hosted install. REQUIRE_PLUGINS and RBAC_LOG_FALLBACK are not set.

Describe the bug

On every webapp boot a self-hosted instance logs this at error level:

RBAC: plugin found but failed to load; falling back to default implementation Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@triggerdotdev/plugins' imported from /triggerdotdev/apps/webapp/build/server/assets/server-build-<hash>.js

The plugin was not found, it is simply not installed. Per the comments in the loader, that case should be silent unless RBAC_LOG_FALLBACK=1, and the "found but failed to load" error is meant only for a plugin that is present but broken.

The cause is the check that tells the two cases apart (rbac/src/index.ts#L167-L209):

const moduleName = "@triggerdotdev/plugins/rbac";
// ...
const isPluginItselfMissing = isModuleNotFound && message.includes(moduleName);

When the whole package is absent, Node's error names only the package, not the subpath: Cannot find package '@triggerdotdev/plugins'. So message.includes("@triggerdotdev/plugins/rbac") is false, and the missing plugin is classified as a broken one.

The SSO and billing loaders use the same check (sso/src/index.ts#L60-L93, billing/src/index.ts#L78). We only saw the RBAC line, presumably because those load lazily. The code is unchanged on main.

Expected: no error log when @triggerdotdev/plugins is not installed.

Reproduction repo

N/A: reproduces with the official chart/image; code links above.

To reproduce
  1. Install or upgrade the official Helm chart 4.8.1 (any self-hosted install without @triggerdotdev/plugins).
  2. kubectl -n <ns> logs deploy/<release>-webapp -c webapp | grep RBAC
  3. See the "plugin found but failed to load" error on each boot.
Suggested fix

Also accept the quoted package name when deciding whether the plugin itself is missing, e.g.

const isPluginItselfMissing =
  isModuleNotFound &&
  (message.includes(moduleName) || message.includes("'@triggerdotdev/plugins'"));

and the same in the SSO and billing loaders. Matching the quoted name, not the bare one, keeps a broken plugin loud: if an installed plugin's own dependency is missing, the message quotes that dependency's name, and @triggerdotdev/plugins appears only unquoted in the imported from path.

Additional information

Harmless at runtime (the fallback is the documented self-hosted behaviour), but an error-level line on every boot sends self-hosters looking for a broken install.

Lingua principale
TypeScript
Stelle
16.5k
Fork
1.5k
Merge medio
1g 15h
PR unite (30g)
17

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di triggerdotdev/trigger.dev

Tutte le issue di triggerdotdev/trigger.dev

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.