Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typeorm CLI not usable - Running CLI returns: TypeError: dataSourceFileExports is not iterable #9330

Closed
Kyle1297 opened this issue Aug 28, 2022 · 1 comment · Fixed by #9332 or GulajavaMinistudio/typeorm#504 · May be fixed by antz-snyk1/gradle-npm-monorepo-example#5

Comments

@Kyle1297
Copy link

Kyle1297 commented Aug 28, 2022

Issue Description

Expected Behavior

To be able to easily run and generate migrations via typeorm CLI.

Actual Behavior

// include the output in code tags like these!
➜  typeorm-bug git:(master) ✗ npm run typeorm:migrate

> typeorm-bug@1.0.0 typeorm:migrate
> typeorm-ts-node-commonjs migration:run --dataSource ./typeorm.config.ts

Error during migration run:
TypeError: dataSourceFileExports is not iterable
    at Function.loadDataSource (~/typeorm-bug/src/commands/CommandUtils.ts:37:34)
    at async Object.handler (~/typeorm-bug/src/commands/MigrationRunCommand.ts:42:26)
➜  typeorm-bug git:(master) ✗ npm run typeorm:generate --name=Testing                          

> typeorm-bug@1.0.0 typeorm:generate
> typeorm-ts-node-commonjs migration:generate ./src/migration/$npm_config_name --dataSource ./typeorm.config.ts

Error during migration generation:
TypeError: dataSourceFileExports is not iterable
    at Function.loadDataSource (~/typeorm-bug/src/commands/CommandUtils.ts:37:34)
    at async Object.handler (~/typeorm-bug/src/commands/MigrationGenerateCommand.ts:73:26)

Steps to Reproduce

Repo available here: https://github.com/Kyle1297/typeorm-bug.git

  1. Run npm i command
  2. Run npm start command
  3. Run npm run typeorm:migrate and npm run typeorm:generate --name=Testing commands to observe errors

My Environment

Dependency Version
Operating System macOS Monterey 12.5.1
Node.js version x.y.zzz
Typescript version x.y.zzz
TypeORM version x.y.zzz

Additional Context

This also occurs across multiple 3+ typeorm versions + in a Node 16 docker container running NestJS as well. For this bug, I removed all this extra stuff to create this minimal, reproducible example.

I previously was working with typeorm version 0.2.31 and things were all good.

Relevant Database Driver(s)

DB Type Reproducible
aurora-mysql no
aurora-postgres no
better-sqlite3 no
cockroachdb no
cordova no
expo no
mongodb no
mysql no
nativescript no
oracle no
postgres yes
react-native no
sap no
spanner no
sqlite no
sqlite-abstract no
sqljs no
sqlserver no

Are you willing to resolve this issue by submitting a Pull Request?

  • ✖️ Yes, I have the time, and I know how to start.
  • ✖️ Yes, I have the time, but I don't know how to start. I would need guidance.
  • ✖️ No, I don’t have the time, but I can support (using donations) development.
  • ✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
@rbnayax
Copy link
Contributor

rbnayax commented Aug 28, 2022

This bug was introduced in #8917 where they used (accidentally in my opinion) for...of instead of for...in

rbnayax added a commit to rbnayax/typeorm that referenced this issue Aug 28, 2022
@rbnayax rbnayax mentioned this issue Aug 28, 2022
7 tasks
rbnayax added a commit to rbnayax/typeorm that referenced this issue Aug 28, 2022
rbnayax added a commit to rbnayax/typeorm that referenced this issue Aug 28, 2022
rbnayax added a commit to rbnayax/typeorm that referenced this issue Aug 28, 2022
pleerock pushed a commit that referenced this issue Aug 28, 2022
nordinh pushed a commit to nordinh/typeorm that referenced this issue Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants