benawad / graphql-ts-server-boilerplate

A GraphQL server boilerplate made with Typescript, PostgreSQL, and Redis
693 stars 181 forks source link

Cannot find connection development because its not defined in any orm configuration files #24

Open Aman0802 opened 3 years ago

Aman0802 commented 3 years ago

Hey Ben, So I updated the dependencies and run the boilerplate and am facing the below mentioned issue when I run yarn test and yarn start:

yarn test: `Test suite failed to run

Jest: Got error running globalSetup - F:\programs\boilerplates\graphql-ts-server-boilerplate\src\testUtils\callSetup.js, reason: Cannot find connection test  because its not defined in any orm configuration files.

  at ConnectionOptionsReader.<anonymous> (node_modules/typeorm/connection/ConnectionOptionsReader.js:56:35)
  at step (node_modules/typeorm/node_modules/tslib/tslib.js:143:27)
  at Object.next (node_modules/typeorm/node_modules/tslib/tslib.js:124:57)
  at fulfilled (node_modules/typeorm/node_modules/tslib/tslib.js:114:62)`

yarn start: (node:7936) UnhandledPromiseRejectionWarning: Error: Cannot find connection development because its not defined in any orm configuration files. at ConnectionOptionsReader.<anonymous> (F:\programs\boilerplates\graphql-ts-server-boilerplate\src\connection\ConnectionOptionsReader.ts:55:19) at step (F:\programs\boilerplates\graphql-ts-server-boilerplate\node_modules\typeorm\node_modules\tslib\tslib.js:143:27) at Object.next (F:\programs\boilerplates\graphql-ts-server-boilerplate\node_modules\typeorm\node_modules\tslib\tslib.js:124:57) at fulfilled (F:\programs\boilerplates\graphql-ts-server-boilerplate\node_modules\typeorm\node_modules\tslib\tslib.js:114:62) at processTicksAndRejections (internal/process/task_queues.js:93:5) (Usenode --trace-warnings ...to show where the warning was created) (node:7936) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:7936) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This problem is probably that it isn't reading the connections from ormconfig.json, but I don't get the problem here whatsoever. I have referred the documentation as well as your video and everything seems to be the same and logical. Can anyone help me out with this.

Geegtor commented 2 years ago

First of all - thank you Ben. That's huge.

Secondly, got same issue and found solution here: https://stackoverflow.com/questions/45253571/typeorm-with-multiple-env-setups