Nexus-plugin-prisma: Typo in a Warning message. Should be `nexusPluginPrisma` instead of `nexusPrismaPlugin`

Created on 23 Jun 2020  Β·  8Comments  Β·  Source: graphql-nexus/nexus-plugin-prisma

Bug description

I had a project I made in Prisma 5-6 months ago & haven’t touched since. I was just trying to update it to Prisma Stable. There is a warning that says:

Please add experimentalCRUD: true in the nexusPluginPrisma() constructor if you still wish to enable it.

But instead of nexusPluginPrisma it should be nexusPrismaPlugin I think.

My code is as follows that is working:

const { nexusPrismaPlugin } = require('nexus-prisma')

const schema = makeSchema({
  plugins: [
    nexusPrismaPlugin({
      experimentalCRUD: true,
    }),
  ],
  ...
})

Also, curious if this is the way to go or I have to use https://www.nexusjs.org/#/plugins/prisma in the future?

typbug

All 8 comments

Ah yep that’s a typo!

Yeah you should upgrade to the framework if possible and use the Prisma plugin for the framework.

upgrade to the framework

what do you mean by upgrade? bcz my setup is really old when nexus came out & the new docs look too complicated.

currently, i have @nexus/schema & nexus-prisma installed.

the new docs says:

$ npm add nexus nexus-plugin-prisma

can u point me a working example with new prisma official? should i follow prisma’s docs with nexus or nexus docs itself?

Just realised I think I followed Prisma docs 2 days ago (can’t recall properly, shitty memory tbh) & I installed @nexus/schema & nexus-prisma through there bcz of some other warnings.

So I think the docs are a little inconsistent.

Following the tutorial on the docs, I found this after doing npm add --global nexus:

Were you looking for the old Nexus? β”‚ @nexus/schema

So I assume I should follow new Nexus docs :)

In this example:

https://github.com/graphql-nexus/examples/blob/master/plugin-prisma/api/app.ts

I found:

import { prisma } from 'nexus-plugin-prisma'

use(prisma({ features: { crud: true } }))

But it is not documented in:

https://www.nexusjs.org/#/tutorial/chapter-5-persisting-data-via-prisma

where there is pure prisma() and I have also one problem:

After npm add --global nexus I see:

/home/daniel/.nvm/versions/node/v12.14.1/bin/nexus -> /home/daniel/.nvm/versions/node/v12.14.1/lib/node_modules/nexus/dist/cli/main.js

> [email protected] postinstall /home/daniel/.nvm/versions/node/v12.14.1/lib/node_modules/nexus
> node scripts/postinstall


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                             β”‚
β”‚   Nexus has become a framework!                             β”‚
β”‚   Nexus has become a framework!                             β”‚
β”‚   Nexus has become a framework!                             β”‚
β”‚                                                             β”‚
β”‚   Starting from 0.20.0 the nexus package is a framework.    β”‚
β”‚                                                             β”‚
β”‚   Learn more about the transition:                          β”‚
β”‚   https://nxs.li/schema-to-framework/about                  β”‚
β”‚                                                             β”‚
β”‚   Learn more about the framework:                           β”‚
β”‚   https://nexusjs.org                                       β”‚
β”‚                                                             β”‚
β”‚   Migrate to the framework:                                 β”‚
β”‚   https://nxs.li/schema-to-framework/migrate                β”‚
β”‚                                                             β”‚
β”‚   Were you looking for the old Nexus?                       β”‚
β”‚   @nexus/schema                                             β”‚
β”‚                                                             β”‚
β”‚                                                             β”‚
β”‚   This post-install notice will be removed on July 1 2020   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


β”‚  WARNING from nexus
β”‚  WARNING from nexus
β”‚  WARNING from nexus
β”‚ 
β”‚  nexus bundles graphql and @nexus/schema dependencies.
β”‚  So please uninstall the ones you have installed or you
β”‚  may encounter problems.
β”‚  
β”‚  Run the following command to fix this issue:
β”‚ 
β”‚  npm remove @nexus/schema graphql
β”‚ 
β”‚  If you absolutely need to control the versions of these
β”‚  dependencies then use Yarn and its resolutions feature:
β”‚ 
β”‚  https://classic.yarnpkg.com/en/docs/selective-version-resolutions
β”‚ 
β”‚  If you are curious why nexus bundles these dependencies
β”‚  then refer to the Nexus doc explaining this strategy.
β”‚ 
β”‚  https://nxs.li/why/bundle-dependencies

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/nexus/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] requires a peer of acorn@^6.0.1 but none is installed. You must install peer dependencies yourself.

+ [email protected]
updated 1 package in 8.552s

But after

npm remove @nexus/schema graphql

described issue is not removed.

Without --global I have the same error and in package.json there are no graphql and @nexus/schema

@gustawdaniel what is the issue exactly? I've managed to make the tutorial work, except for the testing part.

I think adding nexus & nexus-plugin-prisma to the dependencies make it work perfectly:

$ npm add nexus nexus-plugin-prisma

And also as you removed graphql & @nexus/schema, it won't be there in package.json :)

  1. Command that you pased:
npm add nexus nexus-plugin-prisma

generated three red warinings

β”‚  WARNING from nexus
β”‚  WARNING from nexus
β”‚  WARNING from nexus

Green command mentioned below:

β”‚  Run the following command to fix this issue:
β”‚ 
β”‚  npm remove @nexus/schema graphql

do not fixes problem and we still see warning.

  1. In case of using crud there is no documentation that shows how to enable this in nexus.

I found in exemplary code:

use(prisma({ features: { crud: true } }))

and it works.


tutorial do not show how how to transform message from console

Please add experimentalCRUD: true in the nexusPluginPrisma() constructor if you still wish to enable it.

to working code because of flag experimentalCRUD is presented for nexusPluginPrisma instead of { features: { crud: true } } options for prisma from nexus-plugin-prisma

@gustawdaniel are you using nexus as a cli? I think Nexus might have a bug there with its dep detection. Didn't think about it before.

For local case though, it should be working.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryands17 picture ryands17  Β·  5Comments

antonbramsen picture antonbramsen  Β·  4Comments

aqwert picture aqwert  Β·  3Comments

mihazs picture mihazs  Β·  4Comments

macrozone picture macrozone  Β·  3Comments