Hi everyone,
I'm using now to deploy a micro graphql server and while I had this repo working yesterday, something happened in the past day and I can't figure out what is going on. Perhaps the easiest way to test is with my minimal example below.
https://github.com/CaptainChemist/zeit-now-prisma-2
Create a mysql database and then update the mysql string in the following repo to your database.
What I am now seeing when I run npm run dev from the home directory is this:
Error: api/src/index.ts(17,7): error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"User">'.
api/src/index.ts(18,7): error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"User">'.
api/src/index.ts(19,7): error TS2339: Property 'model' does not exist on type 'ObjectDefinitionBlock<"User">'.
api/src/index.ts(26,7): error TS2339: Property 'crud' does not exist on type 'ObjectDefinitionBlock<"Query">'.
api/src/index.ts(27,7): error TS2339: Property 'crud' does not exist on type 'ObjectDefinitionBlock<"Query">'.
api/src/index.ts(40,7): error TS2339: Property 'crud' does not exist on type 'ObjectDefinitionBlock<"Mutation">'.
It then says that my @generated/photon/runtime/prisma does not exist. This is after running prisma2 generate and I can see that I have files in the photon and nexus-prisma @generated folder.
Just following up- I can fix the issue by using prisma2 2.0.0-preview-2 and @now/[email protected], so this is definitely due to a combination of a new version of prisma2 and a new version of @now/node.
I believe this is related to zeit's typescript compilation logic as I am able to @now/[email protected] with [email protected], binary version: acd6dd8dcf027b84a94af26b36ded779f1f56b1d
Even though there is this warning, I am also able to run the application with the latest now a builder and the whole API is operations.
For now, the bug is confirmed and it is related to nexus prisma so I am going to transfer this issue.
@pantharshit00
Encounter this same issue. How can one resolve it?
By the way, I'm using [email protected] and @prisma/[email protected]. Don't know anything about @now/node
Success in:
"nexus": "0.11.7"
and
"ts-node-dev": "^1.0.0-pre.40",
Fails in
"nexus": "^0.12.0-beta.6"
or
"ts-node": "8.3.0"
@chenfanggm
Are you also trying to deploy this setup to zeit now?
If no, please provide me with a reproduction repository.
cc @jasonkuhrt maybe
I'm also having this issue, works fine on dev, but the errors crop up on deployment to zeit now.
I am running into this issue with the latest versions of nexus, nexus-prisma and prisma2. It's just the missing types, though, the servers work fine (both locally and on zeit now).
"nexus": "0.12.0-beta.7",
"nexus-prisma": "0.0.1-beta.6",
"prisma2": "2.0.0-alpha.130",
Previously, this worked for me (both locally, and deploying to zeit now).
I was able to fix this by transpiling and running the file that calls makeSchema with babel to avoid type-checking. This creates all the files in @generated/nexus-prisma that will add the model and crud methods. The typescript build passes after that.
You can create a script in package.json to transpile with babel and run the file that includes makeSchema before running tsc
Hey @CaptainChemist, this should be working now. Update your deps. You can see a working example in this repo under /example
Ref https://github.com/prisma/nexus-prisma/issues/367#issuecomment-526921529.
@jasonkuhrt I got this issue and the example did not work.
Steps to reproduce:
npm iprisma.schemaUser to Author in the schema (also the one in a property of Post)prisma2 lift save and name somethingprisma2 lift upprisma2 generateUser to Author in the index.ts.I have been using Windows which might be the cause. Could you please deal with this issue?
Hey @seed-of-apricot, hoping to update those soon, thanks for mentioning.
@jasonkuhrt
The new 0.4.x has released but did you have any updates or workaround so far?
Hey @seed-of-apricot you can refer to the example in this repo. As far as I know this issue is resolved. Is that not the case for you?
@jasonkuhrt
Oh okay the example in the exmaple directory has worked.
But it doesn't have t.model.<something> or t.crud.<anything> which have been the cause of the error, right?
Sorry the definition was separated in another folder.
Are you looking at the blog example https://github.com/prisma-labs/nexus-prisma/blob/master/examples/blog/src/types/Author.ts?
Yeah I didn't notice it, thank you for referring to the example anyways :)
If you're still having this problem, I deleted my node_modules folder and reinstalled everything and it fixed it.
For people that keep running into this problem, or the like, we're quietly unveiling a prototype we've been working on. Check it out, I feel confident saying it makes stuff like this issue a thing of the past:
https://github.com/prisma-labs/graphql-santa
✌🏻🤞🏻
Most helpful comment
Hey @seed-of-apricot, hoping to update those soon, thanks for mentioning.