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

Cannot destructure property 'parsed' of 'req' as it is null. #835

Open
its-dibo opened this issue Mar 29, 2024 · 7 comments · May be fixed by #836
Open

Cannot destructure property 'parsed' of 'req' as it is null. #835

its-dibo opened this issue Mar 29, 2024 · 7 comments · May be fixed by #836

Comments

@its-dibo
Copy link

I just setup a baisc crud with typeORM as in docs, but for Cannot destructure property 'parsed' of 'req' as it is null.

@Entity('users')
export class UserEntity {
  id: string;
}
@Crud({
  model: {
    type: UserEntity,
  },
})
@Controller('users')
export class UsersController implements CrudController<UserEntity> {
  constructor(public service: UsersService) {}
}
@Injectable()
export class UsersService extends TypeOrmCrudService<UserEntity> {
  constructor(
    @InjectRepository(UserEntity) protected repo: Repository<UserEntity>,
  ) {
    super(repo);
  }
}
@Module({
  imports: [TypeOrmModule.forFeature([UserEntity])],
  controllers: [UsersController],
  providers: [UsersService],
  exports: [UsersService],
})
export class UsersModule {}

environment:

Node v20.10.0
"@nestjs/common": "^10.2.10",
    "@nestjs/config": "^3.1.1",
    "@nestjs/core": "^10.2.10",
    "@nestjs/platform-express": "^10.2.10",
    "@nestjs/platform-fastify": "^10.2.10",
    "@nestjs/swagger": "^7.1.16",
    "@nestjs/typeorm": "^10.0.1",
    "@nestjsx/crud": "^5.0.0-alpha.3",
    "@nestjsx/crud-typeorm": "^5.0.0-alpha.3",
    "class-transformer": "^0.5.1",
    "class-validator": "0.14.0",
    "fastify": "^4.24.3",
    "pg": "^8.11.3",
    "reflect-metadata": "^0.1.14",
    "rxjs": "^7.8.1",
    "typeorm": "^0.3.17"
@Kolobok12309
Copy link

Problem in this code with small typo fix CUSTOM_ROUTE_AGRS_METADATA, right version is CUSTOM_ROUTE_ARGS_METADATA

import {
CUSTOM_ROUTE_AGRS_METADATA,
INTERCEPTORS_METADATA,
METHOD_METADATA,
PARAMTYPES_METADATA,
PATH_METADATA,
ROUTE_ARGS_METADATA,
} from '@nestjs/common/constants';

@Kolobok12309
Copy link

Currently i fix it by .pnpmfile.cjs with content

function readPackage(pkg, context) {
  if (pkg.name === '@nestjsx/crud') {
    console.log('crud', pkg.dependencies);
    pkg.dependencies = {
      ...pkg.dependencies,
      '@nestjs/common': '9.0.5',
    };
  }

  return pkg;
}

module.exports = {
  hooks: {
    readPackage
  }
}

For yarn you can try use resolutions of package.json

But both variants is trick and can broke some features of @nestjsx/crud.
Best variant is update code of this repository

Kolobok12309 added a commit to Kolobok12309/crud that referenced this issue Apr 5, 2024
@Kolobok12309 Kolobok12309 linked a pull request Apr 5, 2024 that will close this issue
2 tasks
Kolobok12309 added a commit to Kolobok12309/handler-book that referenced this issue Apr 5, 2024
@afilp
Copy link

afilp commented May 8, 2024

@Kolobok12309 As this repo seems dead (your PR will never be merged), can you please do the same for this fork instead?https://github.com/gid-oss/dataui-nestjs-crud

@afilp
Copy link

afilp commented May 8, 2024

@Kolobok12309
Copy link

This is already solved there, as I can see now:

https://github.com/search?q=repo%3Agid-oss%2Fdataui-nestjs-crud+CUSTOM_ROUTE_ARGS_METADATA+&type=code

Ya, i know)
if I encounter any more errors, i use your repo
Thanks for it)

@its-dibo
Copy link
Author

its-dibo commented May 8, 2024

As this repo seems dead

you are right, I already switched to that repo

@HORKimhab
Copy link

HORKimhab commented Jun 1, 2024

To fix this issue

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

Successfully merging a pull request may close this issue.

4 participants