Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular JSON TypeError in @nestjs/axios #11303

Closed
3 of 15 tasks
sahellebusch opened this issue Mar 20, 2023 · 7 comments
Closed
3 of 15 tasks

Circular JSON TypeError in @nestjs/axios #11303

sahellebusch opened this issue Mar 20, 2023 · 7 comments

Comments

@sahellebusch
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Add HttpModule import to module, HttpService to class and receive the following error when running jest test:

 TypeError: Converting circular structure to JSON
        --> starting at object with constructor 'NestContainer'
        |     property 'modules' -> object with constructor 'Map'
        |     property 'InternalCoreModule' -> object with constructor 'Module'
        --- property 'container' closes the circle
        at stringify (<anonymous>)

Minimum reproduction code

https://github.com/sahellebusch/nestjs-cats-example

Steps to reproduce

  1. npm i
  2. npm run test

Expected behavior

No circular type error.

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

@nestjs/axios

NestJS version

9.3.0

Packages versions

See example repo.

Node.js version

v16.15.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@sahellebusch sahellebusch added the needs triage This issue has not been looked into label Mar 20, 2023
@jmcdo29
Copy link
Member

jmcdo29 commented Mar 20, 2023

Looks like an error when we're trying to throw an error about an improper test configuration (e.g. a missing provider). Interestingly enough, I only see this error when running multiple test files, not when I run each one individually.

@micalevisk
Copy link
Member

I found that this isn't related with @nestjs/axios:

image

image

@micalevisk
Copy link
Member

micalevisk commented Mar 20, 2023

and looks that's happens in v9.3.10 but not in v9.3.9 (npm i @nestjs/core@9.3.9 @nestjs/common@9.3.9 @nestjs/testing@9.3.9), so it's a regression

Not sure why v9.3.9...v9.3.10

@kamilmysliwiec
Copy link
Member

Just to make sure that I'm on the same page - so this issue doesn't occur on the latest version? @micalevisk

@micalevisk
Copy link
Member

micalevisk commented Mar 21, 2023

@kamilmysliwiec it happens on v9.3.10 and v9.3.11 (the latest version as of now). v9.3.9 is fine.

@micalevisk micalevisk removed the needs triage This issue has not been looked into label Mar 21, 2023
@micalevisk
Copy link
Member

micalevisk commented Mar 22, 2023

might be related with this issue on Jest side: jestjs/jest#10577 because it works as expected when using detectOpenHandles: true

But we must fix that on our side as it works with @nestjs/core v9.3.9 (and because that issue is open since 2020 lol)

@kamilmysliwiec
Copy link
Member

Fixed in 9.3.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants