Skip to content

fix: parse Procfile process types containing dashes in heroku local - #3883

Merged
eablack merged 2 commits into
mainfrom
fix/local-procfile-dash-process-type
Aug 21, 2026
Merged

fix: parse Procfile process types containing dashes in heroku local#3883
eablack merged 2 commits into
mainfrom
fix/local-procfile-dash-process-type

Conversation

@eablack

@eablack eablack commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

heroku local fails to parse a Procfile when a process type name contains a dash (e.g. worker-primary), throwing line N parse error: .... This worked in v10.17.0 and regressed in v11.1.1 when the Procfile parser was rewritten.

The line-validation regex in parseProcfile used \w ([A-Za-z0-9_]) for the process-type name, which excludes dashes. For a line like worker-primary: ..., \w+ matched only worker, then expected : but hit -, so the line was treated as malformed and rejected.

The fix broadens the character class to [\w-], i.e. [A-Za-z0-9_-]. This restores the exact character set the previous parser allowed (src/lib/local/foreman/procfile.cjs used [A-Za-z0-9_-]+) and matches Heroku's documented Procfile process-type format. Underscores were already accepted via \w; dashes are the missing piece. Genuinely malformed lines (no colon, invalid characters) are still rejected.

Fixes #3653.

Type of Change

Patch Updates (patch semver update)

  • fix: Bug fix

Testing

Notes:
No setup required. The change is in the Procfile parser used by heroku local.

Steps:

  1. Create a Procfile containing a process type with a dash, e.g.:
    web: npm run start
    worker-primary: npm run worker
    
  2. Run heroku local (or heroku local:run).
  3. Before this change: it errors with line 2 parse error: worker-primary: ....
  4. After this change: the Procfile parses and the processes start as expected.
  5. Unit tests: npx mocha "test/unit/lib/local/load-foreman-procfile.unit.test.ts" — includes a new regression test covering dashes and underscores; all pass.

Related Issues

GitHub issue: #3653

@eablack
eablack requested a review from a team as a code owner August 21, 2026 22:22
@eablack
eablack deployed to AcceptanceTests August 21, 2026 22:22 — with GitHub Actions Active
@eablack
eablack deployed to AcceptanceTests August 21, 2026 22:22 — with GitHub Actions Active
@eablack
eablack deployed to AcceptanceTests August 21, 2026 22:22 — with GitHub Actions Active
@eablack
eablack deployed to AcceptanceTests August 21, 2026 22:22 — with GitHub Actions Active
@eablack
eablack deployed to AcceptanceTests August 21, 2026 22:25 — with GitHub Actions Active
@eablack
eablack deployed to AcceptanceTests August 21, 2026 22:25 — with GitHub Actions Active
@eablack
eablack deployed to AcceptanceTests August 21, 2026 22:25 — with GitHub Actions Active
@eablack
eablack deployed to AcceptanceTests August 21, 2026 22:25 — with GitHub Actions Active

@michaelmalave michaelmalave 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.

Nice addition. LGTM

@eablack
eablack merged commit 5118f40 into main Aug 21, 2026
18 checks passed
@eablack
eablack deleted the fix/local-procfile-dash-process-type branch August 21, 2026 22:34
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.

heroku local fails when process type contains dashes

2 participants