diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c5cbc5540..e8f5ba697 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [8, 10, 12, 13] + node: [10, 12, 13] steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 diff --git a/src/grpc.ts b/src/grpc.ts index 5ce5a5c44..3381e1b32 100644 --- a/src/grpc.ts +++ b/src/grpc.ts @@ -97,19 +97,20 @@ export class GrpcClient { this.auth = options.auth || new GoogleAuth(options); this.fallback = false; + const minimumVersion = '10.0.0'; + if (semver.lt(process.version, minimumVersion)) { + const errorMessage = + `Node.js v${minimumVersion} is a minimum requirement. To learn about legacy version support visit: ` + + 'https://github.com/googleapis/google-cloud-node#supported-nodejs-versions'; + throw new Error(errorMessage); + } + if ('grpc' in options) { this.grpc = options.grpc!; this.grpcVersion = ''; } else { - if (semver.gte(process.version, '8.13.0')) { - this.grpc = grpc; - this.grpcVersion = require('@grpc/grpc-js/package.json').version; - } else { - const errorMessage = - '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. ' + - 'https://github.com/googleapis/gax-nodejs/blob/master/README.md'; - throw new Error(errorMessage); - } + this.grpc = grpc; + this.grpcVersion = require('@grpc/grpc-js/package.json').version; } }