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

Error when generating - Cannot read property 'map' of undefined #414

Closed
MartinMuzatko opened this issue Mar 31, 2022 · 3 comments · Fixed by #415
Closed

Error when generating - Cannot read property 'map' of undefined #414

MartinMuzatko opened this issue Mar 31, 2022 · 3 comments · Fixed by #415
Labels

Comments

@MartinMuzatko
Copy link

Right now, I get an error when trying to use the json schema generator.

I am using:

prisma: ^3.9.1
typescript: ^4.4.4
nodejs: v14.17.6

My Prisma Schema:

generator client {
  provider = "prisma-client-js"
}

generator jsonSchema {
  provider = "prisma-json-schema-generator"
}

datasource db {
  provider = "mysql"
  url      = env("DB_URL")
}

model Event {
  id               Int             @id @default(autoincrement()) @map("ID")
  timestampAppears DateTime?       @map("TimestampAPPEARS") @db.Timestamp(3)
}

The error I am facing:
It looks like dmff.types is undefined.

TypeError: Cannot read property 'map' of undefined
    at Object.transformDMMF (/home/martin/dev/sicongitlab/sicon/modules/db/node_modules/prisma-json-schema-generator/dist/generator/transformDMMF.js:28:38)
    at Object.onGenerate (/home/martin/dev/sicongitlab/sicon/modules/db/node_modules/prisma-json-schema-generator/dist/index.js:36:48)
    at LineStream.<anonymous> (/home/martin/dev/sicongitlab/sicon/modules/db/node_modules/prisma-json-schema-generator/node_modules/@prisma/generator-helper/dist/generatorHandler.js:36:38)
    at LineStream.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at LineStream.Readable.push (internal/streams/readable.js:204:10)
    at LineStream.Transform.push (internal/streams/transform.js:166:32)
    at LineStream._pushBuffer (/home/martin/dev/sicongitlab/sicon/modules/db/node_modules/prisma-json-schema-generator/node_modules/@prisma/generator-helper/dist/byline.js:104:17)
    at LineStream._transform (/home/martin/dev/sicongitlab/sicon/modules/db/node_modules/prisma-json-schema-generator/node_modules/@prisma/generator-helper/dist/byline.js:98:8)
@MartinMuzatko MartinMuzatko changed the title Support Prisma 3 Error when generating - Cannot read property 'map' of undefined Mar 31, 2022
@valentinpalkovic
Copy link
Owner

@MartinMuzatko Thank you for reporting this! Hotfix release is on its way!

valentinpalkovic pushed a commit that referenced this issue Mar 31, 2022
### [2.0.8](v2.0.7...v2.0.8) (2022-03-31)

### Bug Fixes

* Error while generating schema for prisma version < 3.10 ([428b962](428b962)), closes [#414](#414)

### Dependencies and Other Build Updates

* **dev-deps:** bump @swc/cli from 0.1.56 to 0.1.57 ([c83557a](c83557a))
* **dev-deps:** bump @swc/core from 1.2.160 to 1.2.161 ([d97bc5a](d97bc5a))
* **dev-deps:** bump @typescript-eslint/eslint-plugin ([78c72df](78c72df))
* **dev-deps:** bump @typescript-eslint/parser from 5.16.0 to 5.17.0 ([040546a](040546a))
* **dev-deps:** Use exact versions ([113b702](113b702))
@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 2.0.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@MartinMuzatko
Copy link
Author

Thank you for the quick fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants