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

fix(typescript/graphql-apollo-server): update nexus-prisma to use nexus-plugin-prisma #1886

Merged
merged 5 commits into from
Jul 24, 2020

Conversation

bluematter
Copy link
Contributor

When you copy the code manually there are issues with the nexus-prisma lib. They have upgraded and made changes graphql-nexus/nexus-plugin-prisma#630

@nikolasburk nikolasburk added this to the 2.4.0 milestone Jul 23, 2020
@nikolasburk
Copy link
Member

Hey @bluematter, thanks so much for taking the time to submitting this PR. I agree that we probably should be using nexus-plugin-prisma indeed instead of the "old" nexus-prisma. However, right now the tests for this example are failing:

running ./typescript/graphql-apollo-server/package.json
yarn install v1.22.4
warning package.json: No license field
info No lockfile found.
warning typescript-graphql: No license field
[1/5] Validating package.json...
warning typescript-graphql: No license field
[2/5] Resolving packages...
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > @nexus/[email protected]" has incorrect peer dependency "graphql@^14.5.0".
warning "apollo-server > [email protected]" has incorrect peer dependency "graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning "apollo-server > apollo-server-core > [email protected]" has incorrect peer dependency "[email protected] - 14".
[5/5] Building fresh packages...
success Saved lockfile.
$ npm -s run generate

✔ Generated Prisma Client to ./node_modules/@prisma/client in 204ms

You can now start using Prisma Client in your code:

```
import { PrismaClient } from '@prisma/client'
// or const { PrismaClient } = require('@prisma/client')

const prisma = new PrismaClient()
```

Explore the full API: http://pris.ly/d/client

/home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/nexus-plugin-prisma/src/schema/dmmf/utils.ts:16
    throw new Error(`\
          ^
Error: You most likely forgot to initialize the Prisma Client. Please run `prisma2 generate` and try to run it again.
If that does not solve your problem, please open an issue.
    at Object.exports.getPhotonDmmf (/home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/nexus-plugin-prisma/src/schema/dmmf/utils.ts:16:11)
    at Object.exports.getTransformedDmmf (/home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/nexus-plugin-prisma/src/schema/dmmf/transformer.ts:16:47)
    at new SchemaBuilder (/home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/nexus-plugin-prisma/src/schema/builder.ts:254:7)
    at Object.build (/home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/nexus-plugin-prisma/src/schema/builder.ts:173:19)
    at Object.onInstall (/home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/nexus-plugin-prisma/src/schema/index.ts:45:62)
    at /home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/@nexus/schema/src/builder.ts:713:44
    at Array.forEach (<anonymous>)
    at SchemaBuilder.beforeWalkTypes (/home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/@nexus/schema/src/builder.ts:707:18)
    at SchemaBuilder.getFinalTypeMap (/home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/@nexus/schema/src/builder.ts:797:10)
    at makeSchemaInternal (/home/runner/work/prisma-examples/prisma-examples/typescript/graphql-apollo-server/node_modules/@nexus/schema/src/builder.ts:1597:15)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
##[error]Process completed with exit code 1.

I believe the issue might be that we still explicitly list the @prisma/cli and @prisma/client dependencies which are included in the nexus-plugin-prisma package already – removing these dependencies should fix the problem.

Do you think you could adjust the PR to see if removing these deps fixes the problem?

@janpio
Copy link
Contributor

janpio commented Jul 24, 2020

I just committed a fix that will hopefully make the tests pass here: Nexus PLugin Prisma now comes with its own Prisma dependencies.

@janpio janpio requested review from Weakky and jasonkuhrt July 24, 2020 10:26
@nikolasburk nikolasburk merged commit 67c8fee into prisma:master Jul 24, 2020
@nikolasburk
Copy link
Member

Thanks a lot Jan 🙏

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

Successfully merging this pull request may close these issues.

3 participants