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

NestJS Error Debug Failure. False expression: Too many nodes written to output #564

Open
2 of 9 tasks
accarvajal opened this issue Aug 2, 2023 · 4 comments
Open
2 of 9 tasks
Labels
bug Something isn't working

Comments

@accarvajal
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

I'm using package in NestJS v10 and I followed the documentation.

According samples, to avoid decorating classes with @AutoMap(), I can use a transformer plugin that enables automapper to run a before transformer looking for .entity.ts .model.ts, etc. files and add them to a list for mappings. So I configured nest-cli.json as shown below:

{
      "$schema": "https://json.schemastore.org/nest-cli",
      "collection": "@nestjs/schematics",
      "sourceRoot": "src",
      "compilerOptions": {
           "plugins": [
                 "@automapper/classes/transformer-plugin"
           ]
       }
}

However when I run the app by using nest start, it throws the error:

Error Debug Failure. False expression: Too many nodes written to output.

In order to get the app working, I have to remove plugins entry leaving compilerOptions empty.

dependencies used:

  "dependencies": {
    "@automapper/classes": "^8.7.7",
    "@automapper/core": "^8.7.7",
    "@automapper/nestjs": "^8.7.7",
    "@nestjs/common": "^10.1.2",
    "@nestjs/config": "^3.0.0",
    "@nestjs/core": "^10.1.2",
    "@nestjs/cqrs": "^10.0.1",
    "@nestjs/jwt": "^10.0.3",
    "@nestjs/passport": "^10.0.0",
    "@nestjs/platform-express": "^10.1.2",
    "@nestjs/swagger": "^7.1.4",
    "@nestjs/throttler": "^4.0.0",
    "@nestjs/typeorm": "^10.0.0",
    "bcrypt": "^5.1.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.0",
    "passport": "^0.6.0",
    "passport-jwt": "^4.0.1",
    "passport-local": "^1.0.0",
    "pg": "^8.11.0",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^7.2.0",
    "typeorm": "^0.3.16"
  },
  "devDependencies": {
    "@nestjs/cli": "^10.1.10",
    "@nestjs/schematics": "^10.0.1",
    "@nestjs/testing": "^10.1.2",
    "@types/bcrypt": "^5.0.0",
    "@types/express": "^4.17.13",
    "@types/jest": "29.5.3",
    "@types/node": "20.4.5",
    "@types/passport-jwt": "^3.0.8",
    "@types/passport-local": "^1.0.35",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^6.2.0",
    "@typescript-eslint/parser": "^6.2.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^5.0.0",
    "jest": "29.6.2",
    "prettier": "^3.0.0",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "29.1.1",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "4.2.0",
    "typescript": "^5.1.6",
    "vite": "^4.4.7"
  },

Thanks for any help

Models/DTOs/VMs

No response

Mapping configuration

In AppModule:

AutomapperModule.forRootAsync({
      useClass: AutomapperConfigService,
}),

in AutomapperConfigService:

import { classes } from '@automapper/classes';
import { CreateMapperOptions } from '@automapper/core';
import { AutomapperOptionsFactory } from '@automapper/nestjs';
import { Injectable } from '@nestjs/common';

@Injectable()
export class AutomapperConfigService implements AutomapperOptionsFactory {
  createAutomapperOptions():
    | CreateMapperOptions
    | Promise<CreateMapperOptions> {
    return {
      strategyInitializer: classes(),
    };
  }
}

Steps to reproduce

No response

Expected behavior

The error should not be thrown, the application should start running and allow me to run mapper without using the decorator @AutoMap().

Screenshots

image

Minimum reproduction code

No response

Package

  • I don't know.
  • @automapper/core
  • @automapper/classes
  • @automapper/nestjs
  • @automapper/pojos
  • @automapper/mikro
  • @automapper/sequelize
  • Other (see below)

Other package and its version

No response

AutoMapper version

8.7.7

Additional context

Windows 11

@accarvajal accarvajal added the bug Something isn't working label Aug 2, 2023
@accarvajal
Copy link
Author

accarvajal commented Aug 2, 2023

Due to the nest start command when throws the error get stuck, I run the command nest start --watch and I noticed that after making some code changes, it rebuilds and throws the following statck trace:

image

@yuchuanxi
Copy link

I have the same problem with version 8.7.7

@davissimo
Copy link

davissimo commented Sep 13, 2023

Same issue as well using NestJs 10.2.4 and Typescript 5.1.6, making the plugin not usable.

I see that the last commit or any issues closed by maintainer was in March.
@nartc Is the library still maintained and to be utilized in production?

PS: I see that NestJs 10 (that @accarvajal is using as well) is not listed.
Is it not supported at the moment?

Update: I see that there's a PR pending (since June, does not solve this issue) adding Nest 10 support that hasn't been merged. In fact nothing has past March.

@ttshivers
Copy link

I've fixed this in my fork https://github.com/ttshivers/mapper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants