crud
crud copied to clipboard
Cannot destructure property 'parsed' of 'req' as it is null.
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"
Problem in this code with small typo fix CUSTOM_ROUTE_AGRS_METADATA, right version is CUSTOM_ROUTE_ARGS_METADATA
https://github.com/nestjsx/crud/blob/d6d3c4ebd844d543ab71b494d424660c448a9d42/packages/crud/src/crud/reflection.helper.ts#L2-L9
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 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
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
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)
As this repo seems dead
you are right, I already switched to that repo
To fix this issue
- create folder 'patches' in project nestjs
- copy these file to dir patches @nestjsx+crud+5.0.0-alpha.3.patch @nestjsx+crud-typeorm+5.0.0-alpha.3.patch
- install 'patch-package' via
npm i --save patch-package - Add
"postinstall": "patch-package"in scripts of package.json - Run
npm run postinstall