You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const connectionConfig = {
host: getEnvVar('POSTGRES_HOST'),
port: Number(getEnvVar('POSTGRES_PORT')),
username: getEnvVar('POSTGRES_USER'),
password: getEnvVar('POSTGRES_PASSWORD'),
database: getEnvVar('POSTGRES_DB'),
};
export const getDataSource = () => {
return new DataSource({
type: 'postgres',
...connectionConfig,
synchronize: false,
logging:
process.env.NODE_ENV !== 'production' &&
process.env.DEBUG === 'true',
entities: [User, Provider, Pet],
// TODO (task #27) needs to work after build with js files as well
migrations: [join(__dirname, 'migrations/*.ts')],
subscribers: [],
});
};
export const AppDataSource = getDataSource();
export const entityManager = AppDataSource.manager;
The NPM script im running is "seed:run": "ts-node -r tsconfig-paths/register ./../../node_modules/@jorgebodega/typeorm-seeding/dist/cli.js seed -d src/data-source.ts src/seeds/*.ts"
The Error im getting:
nx run backend:seed:run
> nx run backend:"seed:run"
> [email protected] seed:run
> ts-node -r tsconfig-paths/register ./../../node_modules/@jorgebodega/typeorm-seeding/dist/cli.js seed -d src/data-source.ts src/seeds/*.ts
- Loading datasource
Error: Unable to open file: "/Users/jesseberman/Development/Den/packages/backend/src/data-source.ts". ⨯ Unable to compile TypeScript:
src/entity/User.ts(4,2): error TS1238: Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
src/entity/User.ts(6,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(7,5): error TS2564: Property 'id' has no initializer and is not definitely assigned in the constructor.
src/entity/User.ts(9,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(12,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(15,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(16,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(17,5): error TS2564: Property 'username' has no initializer and is not definitely assigned in the constructor.
src/entity/User.ts(19,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(20,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(21,5): error TS2564: Property 'email' has no initializer and is not definitely assigned in the constructor.
src/entity/User.ts(23,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
at Function.loadDataSource (/Users/jesseberman/Development/Den/node_modules/src/commands/CommandUtils.ts:22:19)
at async Command.run (/Users/jesseberman/Development/Den/node_modules/@jorgebodega/typeorm-seeding/src/commands/seed.command.ts:22:18)
at async Command.parseAsync (/Users/jesseberman/Development/Den/node_modules/@jorgebodega/typeorm-seeding/node_modules/commander/lib/command.js:916:5)
at async bootstrap (/Users/jesseberman/Development/Den/node_modules/@jorgebodega/typeorm-seeding/src/commands/seed.command.ts:72:1)
✖ Could not load the data source!
DataSourceImportationError: Could not load the data source!
at Command.run (/Users/jesseberman/Development/Den/node_modules/@jorgebodega/typeorm-seeding/src/commands/seed.command.ts:30:11)
at async Command.parseAsync (/Users/jesseberman/Development/Den/node_modules/@jorgebodega/typeorm-seeding/node_modules/commander/lib/command.js:916:5)
at async bootstrap (/Users/jesseberman/Development/Den/node_modules/@jorgebodega/typeorm-seeding/src/commands/seed.command.ts:72:1) {
[cause]: Error: Unable to open file: "/Users/jesseberman/Development/Den/packages/backend/src/data-source.ts". ⨯ Unable to compile TypeScript:
src/entity/User.ts(4,2): error TS1238: Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
src/entity/User.ts(6,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(7,5): error TS2564: Property 'id' has no initializer and is not definitely assigned in the constructor.
src/entity/User.ts(9,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(12,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(15,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(16,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(17,5): error TS2564: Property 'username' has no initializer and is not definitely assigned in the constructor.
src/entity/User.ts(19,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(20,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
src/entity/User.ts(21,5): error TS2564: Property 'email' has no initializer and is not definitely assigned in the constructor.
src/entity/User.ts(23,6): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Object'.
at Function.loadDataSource (/Users/jesseberman/Development/Den/node_modules/src/commands/CommandUtils.ts:22:19)
at async Command.run (/Users/jesseberman/Development/Den/node_modules/@jorgebodega/typeorm-seeding/src/commands/seed.command.ts:22:18)
at async Command.parseAsync (/Users/jesseberman/Development/Den/node_modules/@jorgebodega/typeorm-seeding/node_modules/commander/lib/command.js:916:5)
at async bootstrap (/Users/jesseberman/Development/Den/node_modules/@jorgebodega/typeorm-seeding/src/commands/seed.command.ts:72:1)
}
npm ERR! Lifecycle script `seed:run` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: [email protected]
npm ERR! at location: /Users/jesseberman/Development/Den/packages/backend
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Ran target seed:run for project backend (2s)
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]
The text was updated successfully, but these errors were encountered:
Checking the error that you have... Are you sure this is related to this library? Seems like you have some kind of problems with the entity, and maybe you should check that before. Or maybe is something related to TypeORM itself
My factory class
My seed class
My Entity Class
My data-source.ts:
The NPM script im running is
"seed:run": "ts-node -r tsconfig-paths/register ./../../node_modules/@jorgebodega/typeorm-seeding/dist/cli.js seed -d src/data-source.ts src/seeds/*.ts"
The Error im getting:
The text was updated successfully, but these errors were encountered: