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 set property metadata of #<Repository> which has only a getter #8789

Closed
sm1le404 opened this issue Mar 23, 2022 · 2 comments
Closed

Comments

@sm1le404
Copy link

sm1le404 commented Mar 23, 2022

Custom repository doesn't work

Expected Behavior

App has started without errors

Actual Behavior

When i start app, get next exception:

[Nest] 79074 - 03/23/2022, 10:53:54 PM ERROR [ExceptionHandler] Cannot set property metadata of # which has only a getter
TypeError: Cannot set property metadata of #<Repository> which has only a getter
at EntityManager.getCustomRepository (/task-manager/src/entity-manager/EntityManager.ts:1398:59)
at DataSource.getCustomRepository (/task-manager/src/data-source/DataSource.ts:463:29)
at InstanceWrapper.useFactory [as metatype] (/task-manager/node_modules/@nestjs/typeorm/dist/typeorm.providers.js:13:35)
at Injector.instantiateClass (/task-manager/node_modules/@nestjs/core/injector/injector.js:333:55)
at callback (/task-manager/node_modules/@nestjs/core/injector/injector.js:48:41)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Injector.resolveConstructorParams (/task-manager/node_modules/@nestjs/core/injector/injector.js:122:24)
at Injector.loadInstance (/task-manager/node_modules/@nestjs/core/injector/injector.js:52:9)
at Injector.loadProvider (/task-manager/node_modules/@nestjs/core/injector/injector.js:74:9)
at async Promise.all (index 3)

Steps to Reproduce

just use "typeorm": "^0.3.3",

Repository example

import { EntityRepository, Repository } from 'typeorm';
import { Task } from './task.entity';

@EntityRepository(Task)
export class TasksRepository extends Repository<Task> {}

My Environment

"typeorm": "^0.3.3",

Relevant Database Driver(s)

DB Type Reproducible
aurora-mysql no
aurora-postgres no
better-sqlite3 no
cockroachdb no
cordova no
expo no
mongodb no
mysql no
nativescript no
oracle no
postgres yes
react-native no
sap no
sqlite no
sqlite-abstract no
sqljs no
sqlserver no

Are you willing to resolve this issue by submitting a Pull Request?

  • ✖️ Yes, I have the time, and I know how to start.
  • ✅ Yes, I have the time, but I don't know how to start. I would need guidance.
  • ✖️ No, I don’t have the time, but I can support (using donations) development.
  • ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
@Ginden
Copy link
Collaborator

Ginden commented Mar 24, 2022

Version 0.3 isn't compatible with @nestjs/typeorm yet.

Please check their repository for details.

@davidsandoz
Copy link

davidsandoz commented Mar 21, 2023

Since v8.1.0, @nestjs/typeorm is compatible with TypeORM 0.3.

I was able to make the necessary changes by following this article.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants