Skip to content
This repository was archived by the owner on Nov 18, 2025. It is now read-only.

Commit 511fc23

Browse files
Benjamin E. Coealexander-fenster
andauthored
feat!: throw for versions of Node.js older than v10.0.0 (#748)
* feat!: throw for versions of Node.js older than v10.0.0 * chore: address code review * chore: add a space * chore: remove node 8 from CI Co-authored-by: Alexander Fenster <[email protected]>
1 parent b1eccf9 commit 511fc23

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
node: [8, 10, 12, 13]
12+
node: [10, 12, 13]
1313
steps:
1414
- uses: actions/checkout@v1
1515
- uses: actions/setup-node@v1

src/grpc.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,20 @@ export class GrpcClient {
9797
this.auth = options.auth || new GoogleAuth(options);
9898
this.fallback = false;
9999

100+
const minimumVersion = '10.0.0';
101+
if (semver.lt(process.version, minimumVersion)) {
102+
const errorMessage =
103+
`Node.js v${minimumVersion} is a minimum requirement. To learn about legacy version support visit: ` +
104+
'https://github.com/googleapis/google-cloud-node#supported-nodejs-versions';
105+
throw new Error(errorMessage);
106+
}
107+
100108
if ('grpc' in options) {
101109
this.grpc = options.grpc!;
102110
this.grpcVersion = '';
103111
} else {
104-
if (semver.gte(process.version, '8.13.0')) {
105-
this.grpc = grpc;
106-
this.grpcVersion = require('@grpc/grpc-js/package.json').version;
107-
} else {
108-
const errorMessage =
109-
'To use @grpc/grpc-js you must run your code on Node.js v8.13.0 or newer. Please see README if you need to use an older version. ' +
110-
'https://github.com/googleapis/gax-nodejs/blob/master/README.md';
111-
throw new Error(errorMessage);
112-
}
112+
this.grpc = grpc;
113+
this.grpcVersion = require('@grpc/grpc-js/package.json').version;
113114
}
114115
}
115116

0 commit comments

Comments
 (0)