Skip to content

fix(cli): restrict config stripping to resolved config path - #5166

Closed
Mina-Sayed wants to merge 1 commit into
triggerdotdev:mainfrom
Mina-Sayed:fix/5165-config-plugin-path
Closed

Mina-Sayed wants to merge 1 commit into
triggerdotdev:mainfrom
Mina-Sayed:fix/5165-config-plugin-path

Conversation

@Mina-Sayed

Copy link
Copy Markdown

Refs #5165

Summary

The trigger-config-strip esbuild plugin currently matches files based on the configuration filename rather than its resolved path.

This can cause unrelated modules with matching filenames to be incorrectly transformed, potentially resulting in Cannot set properties of undefined (setting 'build') when they do not export a Trigger.dev configuration.

✅ Checklist


Testing

Added an integration regression test using esbuild that covers:

  • Stripping build options from the actual Trigger.dev configuration.
  • Preserving unrelated modules with identical filenames in nested directories.
  • Preserving modules with matching filename suffixes.
  • Ensuring build-only configuration values are excluded from the generated bundle.

The regression test has been implemented but has not yet been executed. The original reporter's deployment failure has not been independently reproduced.

Planned verification:

pnpm --filter trigger.dev test --run src/config.test.ts
pnpm run build --filter trigger.dev
pnpm run format
pnpm run lint
pnpm run knip

Changelog

  • Restrict configuration stripping to the resolved configuration file.
  • Respect esbuild's symlink preservation setting.
  • Escape regular expression metacharacters in configuration filenames.
  • Add regression coverage and a patch changeset.
  • Preserve existing configuration transformation behavior for the intended file.

Screenshots

Not applicable. This change affects CLI bundling behavior and does not introduce UI changes.

@changeset-bot

changeset-bot Bot commented Nov 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cfef3bc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
trigger.dev Patch
@trigger.dev/build Patch
@trigger.dev/convex Patch
@trigger.dev/core Patch
@trigger.dev/linear Patch
@trigger.dev/python Patch
@trigger.dev/react-hooks Patch
@trigger.dev/redis-worker Patch
@trigger.dev/rsc Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/slack Patch
@trigger.dev/sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Hi @Mina-Sayed, 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 29, 2026
@coderabbitai

coderabbitai Bot commented Nov 29, 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 +125 to +127
if (resolve(args.path) !== configPath) {
return;
}

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.

🟡 Build options retained on Windows

On case-insensitive Windows, configPlugin skips stripping when --config spells a parent directory with different casing. esbuild keeps the supplied spelling, but realpath returns the on-disk spelling. Build-only options stay in the worker bundle.

Learn more

The deploy command passes --config to loadConfig. The pinned c12 loader uses Jiti, whose ESM resolver uses Node's JavaScript realpathSync; it preserves the spelling of ordinary, non-symlink path components. createEntryPointManager passes that absolute path to esbuild, whose file resolver keeps the supplied parent directory spelling. In contrast, the Windows native realpath used during plugin setup returns the normalized filesystem path. The old basename filter still matched when only the directory casing differed, but the new full-path comparison rejects the config.

Example: On case-insensitive NTFS, deploy with --config C:\WORK\app\trigger.config.ts when the directory is named Work. Both spellings open the same file, but the plugin skips it and leaves its build options in the generated config.

Recommended fix: When symlinks are not preserved, compare paths canonicalized by the same API, including canonicalizing candidate paths that miss the fast lexical comparison. Include both the supplied and canonical basenames in the filter so a differently cased filename can reach the comparison. Do not unconditionally lowercase paths, since Windows also supports case-sensitive directories. Add an integration case that passes a differently cased config path on a case-insensitive filesystem.

Devin Review


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

Comment on lines +124 to +131
absWorkingDir: cwd,
entryPoints: ["entry.ts"],
bundle: true,
write: false,
platform: "node",
format: "cjs",
plugins: [plugin!],
});

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.

🔍 Symlink handling lacks regression coverage

The test imports a regular config file. createEntryPointManager instead passes the config as an entry point. Exercise a symlinked entry point with different link and target names under both symlink settings.

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.

1 participant