#Nest throws an internal server error despite specifying ConflictException

40 messages · Page 1 of 1 (latest)

mint wren
#

is this a nestjs v10 change?

#
 @Post(":multiTradeId/acknowledge")
  @HttpCode(HttpStatus.OK)
  async acknowledgeMultiTrade(@Param("multiTradeId") multiTradeId: string) {
    throw new BadRequestException("Not implemented.");
    await this.multiTradeService.acknowledge(multiTradeId);
  }
#
{
  "statusCode": 500,
  "message": "Internal server error"
}
hollow vigil
#

Everything is udated to v10?

mint wren
#

idk why i said that in the project im in its v9

hollow vigil
#

Is everything on the same nest version?

mint wren
#

i believe so

hollow vigil
#

npx nest info?

coarse fieldBOT
#

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.

hollow vigil
#

What's the stack trace in the terminal?

mint wren
#

i assumed it was a package version different from another so i made sure all versions were the same

#

(it sa monorepo)

#

for each sub app

hollow vigil
#

Oh boy. what kind of monorepo?

mint wren
#

nothing big just two small sub apps and i have core and common installed at root

#

turborepo

#

this is the more interesting error

hollow vigil
#

Do you have a common node_modules or a node_modules per app?

mint wren
#

yea using pnpm so they all link back to the same place

hollow vigil
mint wren
#

yes

#

no

hollow vigil
hollow vigil
mint wren
#

they don't

#

they both use platform-fastify and each have their own if that helps

hollow vigil
#

That might be an issue

#

Because @nestjs/platform-fastify has peer deps on @nestjs/common

mint wren
#

does that explain the type error im getting for FastifyAdapter

hollow vigil
#

There's a decent chance, yeah

mint wren
#

i'll try installing it at root then

hollow vigil
#

Especially if it doesn't match the common and core version exactly

mint wren
#

after i tried making sure all packages were the same version i started getting this error (instead of the app running and not handling the thrown error properly)

Nest can't resolve dependencies of the EventSubscribersLoader (DiscoveryService, EventEmitter, EventsMetadataAccessor, MetadataScanner, ?). Please make sure that the argument ModuleRef at index [4] is available in the EventEmitterModule context.

I remember this error and its usually when you have a version mismatch, I just fixed that by pinning versions (9.4.0 vs ^9.4.0). So now I'm back to issue with the http error not being handled properly

#

does this clear up it being a version mismatch?

hollow vigil
#

Yeah, if ModuleRef or Reflector ever show up, it's usually a mutliple version install issue or version mismatch

mint wren
#

well back to square one

#

ok

#

i got it was still a version mismatch

#

but with rxjs