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

Aberta Para iniciantes
#5,083 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@itsfaryal já está trabalhando nisso.

Desde 28/10/2026.

  • #5102 de @cocvn157 — fechado sem integrar

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
82/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
authorization

Direção de pesquisa

Comece em internal-packages/rbac/src/index.ts por volta das linhas 167-209, onde a mensagem ERR_MODULE_NOT_FOUND é comparada com @triggerdotdev/plugins/rbac para decidir se o próprio plugin está ausente. Reproduza o formato da mensagem tentando um import dinâmico de um pacote não instalado no Node, depois amplie a checagem de plugin ausente para também corresponder ao nome do pacote entre aspas, mantendo alto e claro um plugin instalado quebrado. Aplique a mesma mudança aos loaders em internal-packages/sso/src/index.ts (linhas 60-93) e internal-packages/billing/src/index.ts (linha 78); concluído quando os três permanecerem silenciosos para um pacote ausente, mas ainda registrarem o erro para um presente, porém quebrado.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
16.5k
Forks
1.5k
Merge médio
1d 15h
PRs com merge (30d)
17

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de triggerdotdev/trigger.dev

Todas as issues de triggerdotdev/trigger.dev

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.