Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Issue description
if you have more than one embeded nested in each other and in the nested embeded and you select it it will throw error that it cannot find the selection.
Expected Behavior
@Entity()
export class Image {
@PrimaryGeneratedColumn()
id!: number;
@Column()
title!: string;
@Column()
file!: string;
}
class Media {
@ManyToMany(() => Image)
@JoinTable()
images!: Image[];
}
class Body {
@Column()
text!: string;
@Column(() => Media)
media!: Media;
}
@Entity()
export class Post {
@PrimaryGeneratedColumn()
id!: number;
@Column()
title!: string;
@Column(() => Body)
body!: Body;
}
async function init() {
const AppDataSource = new DataSource({
type: "sqlite",
database: "test.sqlite",
synchronize: true,
entities: [Image, Post],
logging: true,
migrations: [],
});
await AppDataSource.initialize();
const postRepo = AppDataSource.getRepository(Post);
await postRepo.find({
relations: {
body: {
media: {
images: true,
},
},
},
select: {
title: true,
body: {
media: {
images: true,
},
},
},
});
}
init();this should work and return an empty array.
Actual Behavior
but it will raise an error
~/typeorm_test/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/src/util/OrmUtils.ts:225
obj = obj[segments[i]]
^
TypeError: Cannot read properties of undefined (reading 'media')
at Function.deepValue (~/typeorm_test/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/src/util/OrmUtils.ts:225:22)
at ~/typeorm_test/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/src/query-builder/SelectQueryBuilder.ts:3938:36
at Array.forEach (<anonymous>)
at SelectQueryBuilder.buildRelations (~/typeorm_test/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/src/query-builder/SelectQueryBuilder.ts:3924:32)
at ~/typeorm_test/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/src/query-builder/SelectQueryBuilder.ts:3935:22
at Array.forEach (<anonymous>)
at SelectQueryBuilder.buildRelations (~/typeorm_test/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/src/query-builder/SelectQueryBuilder.ts:3924:32)
at SelectQueryBuilder.applyFindOptions (~/typeorm_test/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/src/query-builder/SelectQueryBuilder.ts:3113:22)
at SelectQueryBuilder.setFindOptions (~/typeorm_test/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/src/query-builder/SelectQueryBuilder.ts:105:14)
at EntityManager.find (~/typeorm_test/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/src/entity-manager/EntityManager.ts:1104:14)
```
### Steps to reproduce
you can copy paste the whole code from expected behaviour.
### My Environment
| Operating System | |
| Node.js version | 18.19.0 |
| Typescript version | 5.0.4 |
| TypeORM version | 0.3.20 |
### Additional Context
_No response_
### Relevant Database Driver(s)
- [ ] aurora-mysql
- [ ] aurora-postgres
- [ ] better-sqlite3
- [ ] cockroachdb
- [ ] cordova
- [ ] expo
- [ ] mongodb
- [ ] mysql
- [ ] nativescript
- [ ] oracle
- [ ] postgres
- [ ] react-native
- [ ] sap
- [ ] spanner
- [ ] sqlite
- [ ] sqlite-abstract
- [ ] sqljs
- [ ] sqlserver
### Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.
Activity
github-actions commentedon Sep 18, 2025
TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).
As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.
🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.