Repository navigation
fix(cli): restrict config stripping to resolved config path - #5166
Mina-Sayed wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: cfef3bc The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
|
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. |
|
Caution Review failedThe pull request is closed.
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. |
| if (resolve(args.path) !== configPath) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
🟡 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
| absWorkingDir: cwd, | ||
| entryPoints: ["entry.ts"], | ||
| bundle: true, | ||
| write: false, | ||
| platform: "node", | ||
| format: "cjs", | ||
| plugins: [plugin!], | ||
| }); |
There was a problem hiding this comment.
🔍 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Refs #5165
Summary
The
trigger-config-stripesbuild 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:
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 knipChangelog
Screenshots
Not applicable. This change affects CLI bundling behavior and does not introduce UI changes.