From 818744530b68d8ed01cdee36db290632f82010de Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Mon, 30 Oct 2023 23:45:59 +0000 Subject: [PATCH 1/3] fix: unhandledRejection types are looser than assumed --- plugin-server/src/main/pluginsServer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin-server/src/main/pluginsServer.ts b/plugin-server/src/main/pluginsServer.ts index 45e6a1c8b07b3..b57eac5cfd235 100644 --- a/plugin-server/src/main/pluginsServer.ts +++ b/plugin-server/src/main/pluginsServer.ts @@ -183,8 +183,8 @@ export async function startPluginsServer( 27, // REBALANCE_IN_PROGRESS ]) - process.on('unhandledRejection', (error: Error) => { - status.error('🤮', `Unhandled Promise Rejection: ${error.stack}`) + process.on('unhandledRejection', (error: Error | any, promise: Promise) => { + status.error('🤮', `Unhandled Promise Rejection: ${error?.stack || error} for promise: ${promise}`) if (error instanceof KafkaJSProtocolError) { kafkaProtocolErrors.inc({ From 9c1280d0945bb645d04d4a37df5e06856b3c66bf Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Mon, 30 Oct 2023 23:52:12 +0000 Subject: [PATCH 2/3] simpler than that --- plugin-server/src/main/pluginsServer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin-server/src/main/pluginsServer.ts b/plugin-server/src/main/pluginsServer.ts index b57eac5cfd235..7ce4d51e97ca3 100644 --- a/plugin-server/src/main/pluginsServer.ts +++ b/plugin-server/src/main/pluginsServer.ts @@ -184,7 +184,7 @@ export async function startPluginsServer( ]) process.on('unhandledRejection', (error: Error | any, promise: Promise) => { - status.error('🤮', `Unhandled Promise Rejection: ${error?.stack || error} for promise: ${promise}`) + status.error('🤮', `Unhandled Promise Rejection: ${error} for promise: ${promise}`) if (error instanceof KafkaJSProtocolError) { kafkaProtocolErrors.inc({ From fd2f8b20e640da8b1d1db8e730f9b43bd8284746 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Tue, 31 Oct 2023 08:14:40 +0000 Subject: [PATCH 3/3] delegate logging the things to the log framework - which should at least be safe --- plugin-server/src/main/pluginsServer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin-server/src/main/pluginsServer.ts b/plugin-server/src/main/pluginsServer.ts index 7ce4d51e97ca3..2257a3c2c97fd 100644 --- a/plugin-server/src/main/pluginsServer.ts +++ b/plugin-server/src/main/pluginsServer.ts @@ -184,7 +184,7 @@ export async function startPluginsServer( ]) process.on('unhandledRejection', (error: Error | any, promise: Promise) => { - status.error('🤮', `Unhandled Promise Rejection: ${error} for promise: ${promise}`) + status.error('🤮', `Unhandled Promise Rejection`, { error, promise }) if (error instanceof KafkaJSProtocolError) { kafkaProtocolErrors.inc({