diff --git a/package-lock.json b/package-lock.json index 22dd69f..f946d73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,14 @@ { "name": "@restorecommerce/chassis-srv", - "version": "1.6.4", + "version": "1.6.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@restorecommerce/chassis-srv", - "version": "1.6.4", + "version": "1.6.5", "license": "MIT", "dependencies": { - "@grpc/grpc-js": "1.12.2", "@restorecommerce/dev": "0.0.13", "@restorecommerce/grpc-client": "2.2.5", "@restorecommerce/kafka-client": "1.2.20", diff --git a/package.json b/package.json index db46672..f680ee0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@restorecommerce/chassis-srv", - "version": "1.6.4", + "version": "1.6.5", "description": "Restore Commerce microservice chassis", "main": "./lib/index.js", "author": "n-fuse GmbH", @@ -17,7 +17,6 @@ ], "typings": "lib/index.d.ts", "dependencies": { - "@grpc/grpc-js": "1.12.2", "@restorecommerce/grpc-client": "2.2.5", "@restorecommerce/kafka-client": "1.2.20", "@restorecommerce/logger": "^1.3.1", diff --git a/src/microservice/server.ts b/src/microservice/server.ts index 21eb744..d7b4a22 100644 --- a/src/microservice/server.ts +++ b/src/microservice/server.ts @@ -2,7 +2,7 @@ import { createLogger } from '@restorecommerce/logger'; import { Logger } from 'winston'; import * as _ from 'lodash'; import { EventEmitter } from 'events'; -import { BindConfig, grpc } from './transport/provider/grpc'; +import { BindConfig, grpcServer } from './transport/provider/grpc'; const transports: Record = {}; @@ -17,7 +17,7 @@ export const registerTransport = (name: string, provider: any): void => { }; // register included providers -registerTransport('grpc', grpc); +registerTransport('grpc', grpcServer); /** * Initializes all configured transports. diff --git a/src/microservice/transport/provider/grpc/index.ts b/src/microservice/transport/provider/grpc/index.ts index 1f344b5..17326c8 100644 --- a/src/microservice/transport/provider/grpc/index.ts +++ b/src/microservice/transport/provider/grpc/index.ts @@ -1,4 +1,3 @@ -import * as grpc from '@grpc/grpc-js'; import * as _ from 'lodash'; import { Logger } from 'winston'; import type { Server as GRPCServer, ServiceImplementation } from 'nice-grpc'; @@ -46,8 +45,6 @@ export class Server { this.config = config; this.logger = logger; - grpc.setLogger(console); - this.server = createServer() .use(tracingMiddleware) .use(metaMiddleware) @@ -70,15 +67,13 @@ export class Server { */ async start(): Promise { if (!this.isBound) { - const credentials = grpc.ServerCredentials.createInsecure(); if (_.has(this.config, 'credentials.ssl')) { // TODO Re-enable // credentials = grpc.credentials.createSsl( // this.config.credentials.ssl.certs); } await this.server.listen( - this.config.addr, - credentials + this.config.addr ).catch(err => { this.logger.error('Error starting server', { message: err.message, code: err.code, stack: err.stack }); throw err; @@ -95,4 +90,4 @@ export class Server { } } -export { Server as grpc }; +export { Server as grpcServer };