Skip to content

fix(rbac,sso,billing): silence false error log when @triggerdotdev/plugins is not installed - #5102

Closed
cocvn157 wants to merge 1 commit into
triggerdotdev:mainfrom
cocvn157:fix/plugin-loader-missing-package-log-5083
Closed

cocvn157 wants to merge 1 commit into
triggerdotdev:mainfrom
cocvn157:fix/plugin-loader-missing-package-log-5083

Conversation

@cocvn157

@cocvn157 cocvn157 commented Nov 6, 2026

Copy link
Copy Markdown

Fixes #5083

When @triggerdotdev/plugins is not installed (the default state on self-hosted deployments), Node's ESM resolver throws ERR_MODULE_NOT_FOUND with Cannot find package '@triggerdotdev/plugins' imported from ... rather than quoting the full @triggerdotdev/plugins/<subpath> specifier. Because the RBAC, SSO, and billing loaders only checked message.includes(moduleName), they treated a missing plugin package as a broken plugin and logged "plugin found but failed to load" at error level on boot.

This updates the RBAC, SSO, and billing loaders to also match the quoted package name "'@triggerdotdev/plugins'" when checking whether the plugin itself is absent, keeping missing-plugin fallback silent by default while still logging an error if a transitive dependency of an installed plugin is missing.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Hi @cocvn157, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Nov 6, 2026
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Devin Review

Comment on lines +173 to +182
const importer = vi.fn(async () => {
const err = Object.assign(
new Error(
"Cannot find package '@triggerdotdev/plugins' imported from /triggerdotdev/apps/webapp/build/server/index.js"
),
{ code: "ERR_MODULE_NOT_FOUND" }
);
throw err;
});
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => undefined);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 New loader tests use forbidden test doubles

The new SSO test uses vi.fn and vi.spyOn instead of exercising a real import. The billing fallback test and RBAC fallback test also add spies, violating the repository's no-mocks rule.

Learn more

The repository's testing rules prohibit mocks, spies, stubs, and fakes, including vi.fn and vi.spyOn. The new SSO case adds both, while the modified billing and RBAC cases add console spies. These cases test the exception classifier with constructed errors rather than observing a real missing-package import.

Example: With the optional package absent, a real dynamic import rejects with Node's own error; these tests instead throw a hand-written string through a fake importer.

Recommended fix: Exercise the real missing-package import in the loader tests. For log assertions, use an integration-level log capture that does not replace or spy on console.error, or restructure the tested behavior to return an observable result.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

}
});

it("stays silent when Node ESM reports the missing bare package '@triggerdotdev/plugins'", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 New SSO test lacks regression annotation

The new SSO test omits the required // Catches: <bug> comment identifying its distinct regression.

Suggested change
it("stays silent when Node ESM reports the missing bare package '@triggerdotdev/plugins'", async () => {
// Catches: Missing bare plugin packages incorrectly produce an error-level load failure.
it("stays silent when Node ESM reports the missing bare package '@triggerdotdev/plugins'", async () => {

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

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.

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

1 participant