paljs / prisma-tools

Prisma tools to help you generate CRUD system for GraphQL servers
https://paljs.com
MIT License
683 stars 54 forks source link

TypeError: gql is not a function #178

Closed ZenSoftware closed 3 years ago

ZenSoftware commented 3 years ago

Hello,

Thank you for releasing Pal.js v2.12.1, that fixed the code generation issue. Though I have upgraded @paljs/plugins and @paljs/cli to v2.12.1, I am now getting the following compilation error.

C:\a\Work\oss\node_modules\@paljs\plugins\src\sdlInputs.ts:129
[0]   return gql`
[0]          ^
[0] TypeError: gql is not a function
[0]     at sdlInputs (C:\a\Work\oss\node_modules\@paljs\plugins\src\sdlInputs.ts:129:10)
[0]     at Module../apps/api/src/app/graphql/prisma/typeDefs.ts (C:\a\Work\oss\dist\apps\api\webpack:\apps\api\src\app\graphql\prisma\typeDefs.ts:16:12)

I suspect it is how you are requiring graphql-tag:

https://github.com/paljs/prisma-tools/blob/cf970a1ec1f789c42cf1079d36a3ed7229fc1132/packages/plugins/src/sdlInputs.ts#L128

Should be

const gql = require('graphql-tag'); // without the parameter destructuring

Thanks again @AhmedElywa

AhmedElywa commented 3 years ago

Fixing this issue with version 2.12.2