Skip to content

Add Warning When ormconfig Fails to Load #6960

Closed

Description

@CatGuardian

Issue type:

[ ] bug report
[x] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Request Description

After about 3 hours of debugging why typeorm migration:create was failing for me, I found out it had an issue loading my ormconfig.js (require('<my-directory>/ormconfig.js') failed inside the load() method of ConnectionOptionsReader.ts).

But MigrationCreateCommand.ts, swallowed up that error instead of letting me know.

Can we please get a WARNING console log message when this happens? I realize the code intentionally swallows the error because it thinks it can proceed without directory defined, but it would be nice to at least get a warning that an error occurred. And what that error is.

Basically, what I'm asking is, can we get a console.log('WARNING, couldn't load the ormconfig file. Proceeding without directory defined.', err) line added here: https://github.com/imnotjames/typeorm/blob/976f9fe4bddd1f209d8115347735f9c565d0ffde/src/commands/MigrationCreateCommand.ts#L59

Another thought: since the ormconfig could fail to load in a bunch of different places due to ConnectionOptionsReader.ts being the reusable component that does the loading, maybe the warning should go somewhere in that file. Maybe wrap the load() method in a try catch and put the warning in the catch statement and rethrow the error? Or something similar like that.

Activity

  1. self-assigned this
    on Oct 26, 2020
  2. github-actions commented on Sep 18, 2025

    @github-actions

    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.

  3. CatGuardian commented on Sep 18, 2025

    @CatGuardian
    Author

    Tremendous Thursday Evening!! 😀

    I would request that this issue be re-opened and worked on.

    I believe I made it really really easy to implement. 😅 I provided a line reference of what file to put it in and I even wrote the console.log line of code for you as well.

    Please consider re-opening this. 😊

  4. reopened this on Sep 19, 2025
  5. added this to the 1.0 milestone on Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions