question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UnhandledPromiseRejectionWarning: Error: A circular dependency has been detected

See original GitHub issue

I’m submitting a…


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Hello I am having issue only on JENKINS with the following package.json “dependencies”: { “@nestjs/common”: “7.4.4”, “@nestjs/core”: “7.4.4”, “@nestjs/microservices”: “7.4.4”, “@nestjs/platform-express”: “7.4.4”, “@nestjs/swagger”: “^4.6.1”, “@nestjs/typeorm”: “7.1.4”, “@nestjs/websockets”: “7.4.4”,

The issue doesnt occur on Windows or MAC. Not sure what is failing on Jenkins which runs on Linux version. PLEASE HELP…

core_1 | 2020-10-22T19:42:23.472811670Z INFO: All classes found using provided glob pattern “/jail-service/core/session/session.entity{.ts,.js}” : “/jail-service/core/session/session.entity.js”

core_1 | 2020-10-22T19:42:23.540807215Z (node:93) UnhandledPromiseRejectionWarning: Error: A circular dependency has been detected (property key: “screening”). Please, make sure that each side of a bidirectional relationships are using lazy resolvers (“type: () => ClassType”).

core_1 | 2020-10-22T19:42:23.540828602Z at SchemaObjectFactory.createNotBuiltInTypeReference (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:190:19)

core_1 | 2020-10-22T19:42:23.540832079Z at SchemaObjectFactory.mergePropertyWithMetadata (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:121:25)

core_1 | 2020-10-22T19:42:23.540835103Z at /jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:67:35

core_1 | 2020-10-22T19:42:23.540837948Z at Array.map (<anonymous>)

core_1 | 2020-10-22T19:42:23.540840485Z at SchemaObjectFactory.exploreModelSchema (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:66:52)

core_1 | 2020-10-22T19:42:23.540843184Z at SchemaObjectFactory.createNotBuiltInTypeReference (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:195:37)

core_1 | 2020-10-22T19:42:23.540845978Z at SchemaObjectFactory.mergePropertyWithMetadata (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:121:25)

core_1 | 2020-10-22T19:42:23.540848594Z at /jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:67:35

core_1 | 2020-10-22T19:42:23.540851132Z at Array.map (<anonymous>)

core_1 | 2020-10-22T19:42:23.540854255Z at SchemaObjectFactory.exploreModelSchema (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:66:52)

core_1 | 2020-10-22T19:42:23.540859186Z at SchemaObjectFactory.createNotBuiltInTypeReference (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:195:37)

core_1 | 2020-10-22T19:42:23.540863225Z at SchemaObjectFactory.mergePropertyWithMetadata (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:121:25)

core_1 | 2020-10-22T19:42:23.540867307Z at /jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:67:35

core_1 | 2020-10-22T19:42:23.540871059Z at Array.map (<anonymous>)

core_1 | 2020-10-22T19:42:23.540874307Z at SchemaObjectFactory.exploreModelSchema (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:66:52)

core_1 | 2020-10-22T19:42:23.540877053Z at SchemaObjectFactory.createNotBuiltInTypeReference (/jail-service/node_modules/@nestjs/swagger/dist/services/schema-object-factory.js:195:37)

core_1 | 2020-10-22T19:42:23.540880358Z (Use node --trace-warnings ... to show where the warning was created)

core_1 | 2020-10-22T19:42:23.540890259Z (node:93) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

core_1 | 2020-10-22T19:42:23.540894180Z (node:93) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


Nest version: X.Y.Z

 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
roopamedisetti1commented, Oct 23, 2020

@nartc i think it was the issue in dto’s… image

It is fixed now… Thank you very much for your assistance… I am closing this issue.

0reactions
jmcdo29commented, May 5, 2021

@roopamedisetti1 could you please elaborate how you fixed, and what was the problem?

You’re probably lopoking for something like this: https://docs.nestjs.com/openapi/types-and-parameters#circular-dependencies

Read more comments on GitHub >

github_iconTop Results From Across the Web

Circular Dependency with Nestjs Swagger 4 - Stack Overflow
I still have the problem. UnhandledPromiseRejectionWarning: Error: A circular dependency has been detected (property key: "KM"). Please, make ...
Read more >
Circular Dependency - A progressive Node.js framework
A circular dependency occurs when two classes depend on each other. For example, class A needs class B, and class B also needs...
Read more >
How to avoid circular dependencies in NestJS - LogRocket Blog
The NestJS documentation advises that circular dependencies be avoided where possible. Circular dependencies create tight couplings between the ...
Read more >
typeorm simplified - Hussain Wali
(node:16680) UnhandledPromiseRejectionWarning: Error: A circular dependency has been detected (property key: "vehicle_type").
Read more >
Avoiding Circular Dependency Issues in Nest.js
A circular dependency occurs when two classes depend on each other. For example, class A needs class B, and class B also needs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found