MichalLytek / typegraphql-prisma

Prisma generator to emit TypeGraphQL types and CRUD resolvers from your Prisma schema
https://prisma.typegraphql.com
MIT License
891 stars 113 forks source link

Incompatibility with Prisma 5.10.x: import_get_platform.binaryTargets is not iterable #442

Closed mwillbanks closed 3 months ago

mwillbanks commented 9 months ago

Describe the Bug import_get_platform.binaryTargets is not iterable

To Reproduce

yarn upgrade --latest @prisma/client prisma
SKIP_PRISMA_VERSION_CHECK=true npx prisma generate

Expected Behavior

Logs

Error: Generator "typegraphql-prisma" failed:

/Volumes/Projects/litmethod-api/node_modules/typegraphql-prisma/node_modules/@prisma/internals/dist/chunk-KZOYY5XX.js:525
var knownBinaryTargets = [...import_get_platform.binaryTargets, "native"];
                                                 ^
TypeError: import_get_platform.binaryTargets is not iterable
    at Object.<anonymous> (/Volumes/Projects/litmethod-api/node_modules/typegraphql-prisma/node_modules/@prisma/internals/dist/chunk-KZOYY5XX.js:525:50)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/Volumes/Projects/litmethod-api/node_modules/typegraphql-prisma/node_modules/@prisma/internals/dist/index.js:129:29)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
Node.js v18.19.0

error Command failed with exit code 1.
node:child_process:965
    throw err;
    ^

Environment (please complete the following information):

Additional Context My guess is that this might be coming into play with the latest changes from 5.10 which is allowing more or less for edge locations, there was a bit of internal restructuring. I am going to try to get to this at some point next week but wanted to log it in the event someone else has time before I can get to it.

MichalLytek commented 9 months ago

SKIP_PRISMA_VERSION_CHECK=true means using untested Prisma version, so this issue could happen.

Feel free to open a PR with the fix, should be pretty easy to fix using the spread operator or deprecated variable.

MichalLytek commented 3 months ago

It should be fixed in v0.28.0 as the code was adjusted to work with Prisma 5.18 🔒