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

stack overflow when compiling app #14799

Closed
4 of 15 tasks
pehrlich-arbor opened this issue Mar 18, 2025 · 1 comment
Closed
4 of 15 tasks

stack overflow when compiling app #14799

pehrlich-arbor opened this issue Mar 18, 2025 · 1 comment
Labels
needs triage This issue has not been looked into

Comments

@pehrlich-arbor
Copy link

pehrlich-arbor commented Mar 18, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When booting the app with the given test module setup, I get a stack overflow. Not sure what's causing it.

Originally I was troubleshooting an issue which occurred sometimes when some a service's constructor throws an error, this would occur. While thinning down the app, this may be that issue is obscured by whatever this is.

I guess there's a double ask here if possible

  • Whatever the underlying issue is
  • Detection of this case, and a better error message. Even if only in test this could be hugely helpful, as that's often where module DAG errors are first encountered.

Minimum reproduction code

https://github.com/pehrlich-arbor/nest-troubleshoot

Steps to reproduce

yarn
yarn jest

You can remove the error by commenting out the either forwardRef, the resolver annotation, or possibly other lines.

Expected behavior

App should boot. Instead we get a stack overflow

    at InstanceWrapper.getInstanceByContextId (/Users/pehrlich/projects/debug2/node_modules/@nestjs/core/injector/instance-wrapper.js:51:20)
    at InstanceWrapper.cloneStaticInstance (/Users/pehrlich/projects/debug2/node_modules/@nestjs/core/injector/instance-wrapper.js:180:37)
    at InstanceWrapper.getInstanceByContextId (/Users/pehrlich/projects/debug2/node_modules/@nestjs/core/injector/instance-wrapper.js:51:20)
    at InstanceWrapper.cloneStaticInstance (/Users/pehrlich/projects/debug2/node_modules/@nestjs/core/injector/instance-wrapper.js:180:37)
    at InstanceWrapper.getInstanceByContextId (/Users/pehrlich/projects/debug2/node_modules/@nestjs/core/injector/instance-wrapper.js:51:20)
    at InstanceWrapper.cloneStaticInstance (/Users/pehrlich/projects/debug2/node_modules/@nestjs/core/injector/instance-wrapper.js:180:37)

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

This test case involves a GraphQL Resolver, but I'm not sure if that's fundamental to the issue - just as far as I could narrow it down.

NestJS version

11.0.5

Packages versions

npx nest info 2025-03-18 14:07:41
npm error could not determine executable to run
npm error A complete log of this run can be found in: /Users/pehrlich/.npm/_logs/2025-03-18T18_08_25_590Z-debug-0.log

here's the full package.json


    "dependencies": {
        "@apollo/server": "^4.10.0",
        "@nestjs/apollo": "^13.0.2",
        "@nestjs/axios": "^4.0.0",
        "@nestjs/common": "11.0.5",
        "@nestjs/config": "^3.3.0",
        "@nestjs/core": "11.0.5",
        "@nestjs/event-emitter": "^2.1.1",
        "@nestjs/graphql": "^12.0.11",
        "@nestjs/platform-express": "11.0.5",
        "@nestjs/schedule": "^4.1.1",
        "@nestjs/typeorm": "^11.0.0",
        "class-transformer": "^0.5.1",
        "class-validator": "^0.14.1",
        "reflect-metadata": "^0.2.0",
        "graphql": "^16.8.1"
    },
    "devDependencies": {
        "jest": "^29.5.0",
        "@nestjs/testing": "^10.4.5",
        "ts-jest": "^29.2.5",
        "ts-loader": "^9.4.3",
        "ts-node": "^10.9.1",
        "tsconfig-paths": "^4.2.0",
        "typescript": "^5.7.2",
        "typescript-eslint": "^8.11.0"
    }

Node.js version

v22.5.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@kamilmysliwiec
Copy link
Member

Let's track this here #14803

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

2 participants