Browse Source

Add stack trace logging for MaxListenersExceededWarning

pull/7400/head
Thomas Kaul 1 month ago
parent
commit
e426e6d744
  1. 9
      apps/api/src/main.ts

9
apps/api/src/main.ts

@ -26,6 +26,15 @@ import { AppModule } from './app/app.module';
import { environment } from './environments/environment'; import { environment } from './environments/environment';
const logger = new Logger('Bootstrap'); const logger = new Logger('Bootstrap');
const processWarningLogger = new Logger('ProcessWarning');
process.on('warning', ({ name, stack }) => {
if (name === 'MaxListenersExceededWarning') {
// Log the stack trace of MaxListenersExceededWarning occurrences to identify
// the event emitter and the call site which registers the listeners
processWarningLogger.warn(stack);
}
});
async function bootstrap() { async function bootstrap() {
// Respect HTTP_PROXY / HTTPS_PROXY / NO_PROXY for outbound HTTP requests // Respect HTTP_PROXY / HTTPS_PROXY / NO_PROXY for outbound HTTP requests

Loading…
Cancel
Save