heroku 11.12.0 → 11.12.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
6
 
7
+ ## [11.12.1-beta.0](https://github.com/heroku/cli/compare/v11.12.0...v11.12.1-beta.0) (2026-10-22)
8
+
9
+ ### Bug Fixes
10
+
11
+ * accept dots in dyno sizes for ps:scale (W-24613548) ([#4006](https://github.com/heroku/cli/issues/4006)) ([7a6a08b](https://github.com/heroku/cli/commit/7a6a08b7448ce1775f0133ceec7b92b1205c2661))
12
+ * show a clear error when an unsupported Node.js version crashes the CLI ([#3995](https://github.com/heroku/cli/issues/3995)) ([65ca0bc](https://github.com/heroku/cli/commit/65ca0bc5c42c2dd864cd4dbc788d4ddf493bb84d))
13
+
14
+ ### Tests
15
+
16
+ * assert command failures from the error runCommand returns ([#3997](https://github.com/heroku/cli/issues/3997)) ([afc97fa](https://github.com/heroku/cli/commit/afc97fa20ac7bd6ec903c0cdb750b5b324810738))
17
+
7
18
  ## [11.12.0](https://github.com/heroku/cli/compare/v11.11.0...v11.12.0) (2026-10-13)
8
19
 
9
20
  ### Features
package/bin/run.js CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env -S node --no-deprecation
2
2
 
3
- import {execute, settings} from '@oclif/core'
3
+ import {
4
+ Errors, flush, handle, run, settings,
5
+ } from '@oclif/core'
4
6
 
5
7
  // Enable performance tracking when oclif:perf is specified in DEBUG
6
8
  if (process.env.DEBUG?.includes('oclif:perf') || process.env.DEBUG === 'oclif:*' || process.env.DEBUG === '*') {
@@ -32,4 +34,40 @@ if (enableTelemetry) {
32
34
  telemetryDebug('Telemetry disabled (%s): skipping telemetry handler setup', reason)
33
35
  }
34
36
 
35
- await execute({dir: import.meta.url})
37
+ // Mirrors @oclif/core's execute(), except an unsupported Node version's
38
+ // load-time crash is replaced with an actionable message (see
39
+ // src/lib/check-node-version.ts).
40
+ await run(process.argv.slice(2), import.meta.url)
41
+ .then(async result => {
42
+ flush()
43
+ return result
44
+ })
45
+ .catch(async error => {
46
+ // Only the guard lookup is protected: if the helper can't load (e.g. a
47
+ // stale build), fall through and report the original error instead.
48
+ let unsupportedNodeError
49
+ try {
50
+ const {isUnsupportedNodeCrash, UNSUPPORTED_NODE_ERROR_CODE, unsupportedNodeMessage} = await import('../dist/lib/check-node-version.js')
51
+ if (isUnsupportedNodeCrash(process.versions.node, error)) {
52
+ // Dependency-free read of the required Node range. Any failure leaves
53
+ // it undefined, which gives the generic wording.
54
+ let enginesRange
55
+ try {
56
+ const {readFileSync} = await import('node:fs')
57
+ enginesRange = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).engines.node
58
+ } catch {
59
+ // Ignore: the message falls back to generic wording.
60
+ }
61
+
62
+ unsupportedNodeError = new Errors.CLIError(unsupportedNodeMessage(process.versions.node, enginesRange), {code: UNSUPPORTED_NODE_ERROR_CODE, exit: 1})
63
+ }
64
+ } catch {
65
+ // Ignore: fall back to the original error below.
66
+ }
67
+
68
+ if (unsupportedNodeError) {
69
+ return handle(unsupportedNodeError)
70
+ }
71
+
72
+ return handle(error)
73
+ })
@@ -34,7 +34,7 @@ export default class Scale extends Command {
34
34
  const { app } = flags;
35
35
  function parse(args) {
36
36
  return _.compact(args.map(arg => {
37
- const change = arg.match(/^([\w-]+)([=+-]\d+)(?::([\w-]+))?$/);
37
+ const change = arg.match(/^([\w-]+)([=+-]\d+)(?::([\w.-]+))?$/);
38
38
  if (!change)
39
39
  return;
40
40
  const quantity = change[2][0] === '=' ? change[2].slice(1) : change[2];
@@ -3,4 +3,4 @@ import { CLIError } from './telemetry-utils.js';
3
3
  * Whether an error is an expected user/environment condition rather than a CLI
4
4
  * bug. Expected errors are recorded in Honeycomb but excluded from Sentry.
5
5
  */
6
- export declare function isExpectedError(error: CLIError): boolean;
6
+ export declare function isExpectedError(error: CLIError, nodeVersion?: string): boolean;
@@ -1,4 +1,5 @@
1
1
  import { NONINTERACTIVE_LOGIN_ERROR_CODE } from '@heroku-cli/command';
2
+ import { isUnsupportedNodeCrash, UNSUPPORTED_NODE_ERROR_CODE } from '../check-node-version.js';
2
3
  // Actionable user-guidance messages the CI git helper rejects with
3
4
  // (src/lib/ci/git.ts) — detached HEAD / not in a git repository.
4
5
  const GIT_USER_ERROR_MESSAGES = [
@@ -9,7 +10,7 @@ const GIT_USER_ERROR_MESSAGES = [
9
10
  * Whether an error is an expected user/environment condition rather than a CLI
10
11
  * bug. Expected errors are recorded in Honeycomb but excluded from Sentry.
11
12
  */
12
- export function isExpectedError(error) {
13
+ export function isExpectedError(error, nodeVersion = process.versions.node) {
13
14
  // 4xx client errors (e.g. HerokuAPIError) — the user's request was rejected,
14
15
  // not a CLI bug. statusCode and http.statusCode are checked independently.
15
16
  if (is4xx(error.statusCode) || is4xx(error.http?.statusCode)) {
@@ -28,6 +29,12 @@ export function isExpectedError(error) {
28
29
  if (error.code === NONINTERACTIVE_LOGIN_ERROR_CODE) {
29
30
  return true;
30
31
  }
32
+ // Unsupported Node.js version. The telemetry `finally` hook sees the raw
33
+ // SyntaxError before bin/run.js converts it, so match the underlying crash
34
+ // as well as the converted error code.
35
+ if (error.code === UNSUPPORTED_NODE_ERROR_CODE || isUnsupportedNodeCrash(nodeVersion, error)) {
36
+ return true;
37
+ }
31
38
  // CI git helper guidance (detached HEAD / not in a git repo).
32
39
  if (GIT_USER_ERROR_MESSAGES.some(message => error.message.includes(message))) {
33
40
  return true;
@@ -0,0 +1,18 @@
1
+ export declare const FIRST_NODE_MAJOR_WITH_V_FLAG = 20;
2
+ export declare const UNSUPPORTED_NODE_ERROR_CODE = "HEROKU_UNSUPPORTED_NODE";
3
+ /**
4
+ * Whether `error` is the load-time crash an unsupported Node version causes:
5
+ * a dependency using newer regex syntax (e.g. the `v` flag) throws a
6
+ * SyntaxError reading "Invalid regular expression flags". Deliberately
7
+ * narrow: other SyntaxErrors (e.g. JSON.parse, or a runtime bad regex
8
+ * pattern) must not match. Fails open (false) when the version can't be
9
+ * parsed.
10
+ */
11
+ export declare function isUnsupportedNodeCrash(nodeVersion: string, error: unknown): boolean;
12
+ /**
13
+ * `enginesRange` is package.json `engines.node`. A plain minimum (`>=20`) reads
14
+ * as "v20 or later"; any other range is shown verbatim rather than parsed, so
15
+ * it can't drift from `engines`. Generic wording when it is missing or not a
16
+ * non-empty string.
17
+ */
18
+ export declare function unsupportedNodeMessage(nodeVersion: string, enginesRange?: string): string;
@@ -0,0 +1,44 @@
1
+ // Kept dependency-free and free of newer syntax/APIs (optional chaining,
2
+ // nullish coalescing, Array#at, regex v/d flags): bin/run.js uses it on Node
3
+ // versions this CLI no longer supports, so it must load and run there.
4
+ // First Node major whose V8 parses the regex `v` flag; older versions crash on it.
5
+ export const FIRST_NODE_MAJOR_WITH_V_FLAG = 20;
6
+ export const UNSUPPORTED_NODE_ERROR_CODE = 'HEROKU_UNSUPPORTED_NODE';
7
+ /**
8
+ * Whether `error` is the load-time crash an unsupported Node version causes:
9
+ * a dependency using newer regex syntax (e.g. the `v` flag) throws a
10
+ * SyntaxError reading "Invalid regular expression flags". Deliberately
11
+ * narrow: other SyntaxErrors (e.g. JSON.parse, or a runtime bad regex
12
+ * pattern) must not match. Fails open (false) when the version can't be
13
+ * parsed.
14
+ */
15
+ export function isUnsupportedNodeCrash(nodeVersion, error) {
16
+ const major = Number.parseInt(String(nodeVersion).replace(/^v/, ''), 10);
17
+ if (Number.isNaN(major) || major >= FIRST_NODE_MAJOR_WITH_V_FLAG) {
18
+ return false;
19
+ }
20
+ // Match by name too: the telemetry worker reconstructs errors as plain
21
+ // `Error`s (keeping `name`), so `instanceof SyntaxError` alone would miss it.
22
+ const e = error;
23
+ const isSyntaxError = error instanceof SyntaxError || Boolean(e && e.name === 'SyntaxError');
24
+ return isSyntaxError && typeof (e && e.message) === 'string' && /invalid regular expression flags/i.test(String(e && e.message));
25
+ }
26
+ /**
27
+ * `enginesRange` is package.json `engines.node`. A plain minimum (`>=20`) reads
28
+ * as "v20 or later"; any other range is shown verbatim rather than parsed, so
29
+ * it can't drift from `engines`. Generic wording when it is missing or not a
30
+ * non-empty string.
31
+ */
32
+ export function unsupportedNodeMessage(nodeVersion, enginesRange) {
33
+ const version = String(nodeVersion).replace(/^v/, '');
34
+ let requirement = 'a newer version of Node.js';
35
+ if (typeof enginesRange === 'string' && enginesRange !== '') {
36
+ const minimum = /^>=\s*v?(\d+(?:\.\d+){0,2})$/.exec(enginesRange);
37
+ requirement = minimum
38
+ ? `Node.js v${minimum[1]} or later`
39
+ : `a Node.js version matching ${enginesRange}`;
40
+ }
41
+ return `The Heroku CLI doesn't support Node.js v${version}. Upgrade to ${requirement}. `
42
+ + 'Or install the standalone Heroku CLI, which includes its own Node.js. '
43
+ + 'See: https://devcenter.heroku.com/articles/heroku-cli';
44
+ }