TypeError: this.subQuery is not a function
See original GitHub issueI don’t really know what I am doing wrong, can you help me?
This is the complete output:
yarn ts-node -r tsconfig-paths/register ../../node_modules/typeorm-seeding/dist/cli.js seed
yarn run v1.22.0
$ /Volumes/SD/Users/bruno/Projects/corona-down/node_modules/.bin/ts-node -r tsconfig-paths/register ../../node_modules/typeorm-seeding/dist/cli.js seed
🌱 TypeORM Seeding v1.4.4
✔ ORM Config loaded
✔ Factories are imported
✔ Seeders are imported
✔ Database connected
✖ Could not run the seed CreateApplicationToken!
TypeError: this.subQuery is not a function
at InsertQueryBuilder.QueryBuilder.createFromAlias (/Volumes/SD/Users/bruno/Projects/corona-down/src/query-builder/QueryBuilder.ts:551:131)
at InsertQueryBuilder.into (/Volumes/SD/Users/bruno/Projects/corona-down/src/query-builder/InsertQueryBuilder.ts:158:32)
at CreateApplicationToken.run (/Volumes/SD/Users/bruno/Projects/corona-down/packages/backend/src/database/seeds/CreateApplicationToken.ts:11:8)
at /Volumes/SD/Users/bruno/Projects/corona-down/node_modules/typeorm-seeding/src/typeorm-seeding.ts:48:17
at step (/Volumes/SD/Users/bruno/Projects/corona-down/node_modules/tslib/tslib.js:139:27)
at Object.next (/Volumes/SD/Users/bruno/Projects/corona-down/node_modules/tslib/tslib.js:120:57)
at /Volumes/SD/Users/bruno/Projects/corona-down/node_modules/tslib/tslib.js:113:75
at new Promise (<anonymous>)
at Object.__awaiter (/Volumes/SD/Users/bruno/Projects/corona-down/node_modules/tslib/tslib.js:109:16)
at Object.exports.runSeeder (/Volumes/SD/Users/bruno/Projects/corona-down/node_modules/typeorm-seeding/src/typeorm-seeding.ts:46:57)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This is my seeder:
import { Factory, Seeder } from 'typeorm-seeding';
import { Connection } from 'typeorm';
import { ApplicationToken } from '@backend/entities/ApplicationToken';
import uniqueString = require('unique-string');
export default class CreateApplicationToken implements Seeder {
public async run(_factory: Factory, connection: Connection): Promise<void> {
await connection
.createQueryBuilder()
.insert()
.into(ApplicationToken)
.values([
{ token: uniqueString() },
])
.execute();
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Error message TypeError: this.subQuery is not a function ...
If I run the tests with jest, I got always the error message TypeError: this.subQuery is not a function with a reference on...
Read more >typeorm/typeorm - Gitter
Error during migration run: TypeError: this.subQuery is not a function. node_modules/typeorm/query-builder/QueryBuilder.js:361:57. Shijie Zhou. @shijiezhou1.
Read more >Meme Overflow
Error message TypeError: this.subQuery is not a function appears https://stackoverflow.com/questions/69066313/806889…
Read more >TypeORM - Query Builder with Subquery
IMPORTANT: What is setParameters() ? When you set some parameters on a subquery, setting values is not ready to execute with the main...
Read more >TypeORM Sucks!! Something I wanted to talk about since ...
Relational query is not supported - subquery on relation etc. Eager loading is not supported. Cannot extend query builder. Repository is just ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This also happened to me, fixed that by setting the
TYPEORM_ENTITIESenvironment variable.The error
TypeError: this.subQuery is not a functionis because typeorm could not find any entities.Please check your paths in your config file