Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NestJs AggregateError, while starting the project

I'm currently working on a backend project using Nest.js with TypeORM and a PostgreSQL database. Everything was running smoothly until I encountered the following error during the startup of my application:

[10:23:44 AM] Starting compilation in watch mode...

[10:23:49 AM] Found 0 errors. Watching for file changes.

[info] [NestFactory] [9/6/2023, 10:23:51 AM] => Starting Nest application... (+0ms)
[info] [InstanceLoader] [9/6/2023, 10:23:51 AM] => PassportModule dependencies initialized (+40ms)
[info] [InstanceLoader] [9/6/2023, 10:23:51 AM] => TypeOrmModule dependencies initialized (+0ms)
[info] [InstanceLoader] [9/6/2023, 10:23:51 AM] => AppModule dependencies initialized (+0ms)
AggregateError: 
    at internalConnectMultiple (node:net:1114:18)
    at afterConnectMultiple (node:net:1667:5)

I didn't make any recent code changes, and I've already tried restarting my application and double-checking my database credentials, but the error persists. Can someone please help me understand what might be causing this AggregateError and how to resolve it?

Any guidance or insights would be greatly appreciated!

What I Tried:

  1. Restarting the Application: Initially, I attempted to resolve the issue by simply restarting my Nest.js application to see if the error would disappear.

  2. Double-Checking Database Credentials: Since the error message mentioned a network-related issue (node:net), I carefully reviewed and confirmed that my PostgreSQL database credentials (such as the host, port, username, and password) were correctly configured in my TypeORM configuration file.

  3. Reviewing Recent Code Changes: I thoroughly inspected my codebase for any recent changes that might have introduced this error. However, I didn't find any recent code modifications that appeared to be directly related to this issue.

What I Was Expecting:

I was expecting that after performing these steps, the application would start successfully without any errors, as it had been running smoothly before. However, despite my efforts, the AggregateError persisted, and I'm currently seeking assistance to understand the root cause of this error and how to resolve it.

like image 800
Salih Burak Çoşkun Avatar asked May 10 '26 08:05

Salih Burak Çoşkun


1 Answers

I got the same error, and managed to solve it. The issue was that i'm using redis as a socket.io adapter, and my redis server was not running. After starting the redis server it works again.

This error was more descriptive in the past...

like image 142
Magyar Balázs Avatar answered May 13 '26 05:05

Magyar Balázs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!