#I Got a broke application after installing @nestjs/websockets

1 messages · Page 1 of 1 (latest)

olive pebble
#

Hi guys, I am using turbo repo with some nestjs applications inside this monorepo. Today, I added @nestjs/websockets in 1 service in this repo. And this service got broken.

I think we faced some conflict when the pnpm tried installing these packages. But I don't know how to solve this problem. I am willing to have a direct call with someone who can help me solve this problem.

I attached the error in the image.
Currently, I am using @nestjs/core, @nestjs/common version 10.1.3 and @nestjs/mongoose version 10.0.1

Thanks.

mossy bough
#

What is the second argument supposed to be?

olive pebble
#

ModuleRef which is provided by @nestjs/common

slim prism
#

What does pnpm why -r @nestjs/common say? Sounds like different versions got installed.

solemn hingeBOT
#

Please run the command npx -y @nestjs/cli info and paste the output in a code block. This will help us determine if there is a version issue in your packages and which version of nest we are triaging.

olive pebble
#

I checked. I am using the same version of @nestjs/common across all services.

white raven
#

What kind of monorepo? Do you have multiple node_modules with multiple @nestjs/common installs?

olive pebble
#

It kinds of that. Because I am using pnpm so all the reused packages will be installed at the root level and use the symbol link to the some node_modules inside each services.

white raven
#

Symlinked on new locations is not the same. The way that JS realms work means that each of those have their own ModuleRef that when instanceofed against other ModukeRefs, even of the same version, it doesn't work properly. It's a super annoying property of JS

olive pebble
#

Yeah. Correct. I faced this issue some time. So annoying. And now I am facing it again.
But the weird thing that I installed all the services with the same version of @nestjs/core and @nestjs/common but I don't know why It happens.

white raven
#

You said that each service has its own node_modules with @nestjs/common and core. The fact that they're symlinked to the same location doesn't change core JS behavior, they're treated as entirely separate versions that have their own Realm which causes instanceof checks to fail

olive pebble
#

Oh. I got your point. But if I remove @nestjs/websockets my application will work well.

white raven
#

Can you run nest info as I requested before?

olive pebble
#

I just ran.

white raven
#

Looks like common core and websockets are all on the same so that's good

olive pebble
#

Yeah. I tried to change all the @nestjs/* packges we are using in the monorepo to the same version.

slim prism
#

Nuke all node_modules and install again? Since you had some troubles before, maybe there's some inconsistency left over?