Weird issue with Prisma deploy


#1

When I run prisma deploy I get this response

post-deploy:
Running graphql get-schema --project db √
Running graphql prepare √

Showing it ran fine, but for some reason it’s not generating the files.


#2

Did you ever find a solution? I’m having a similar problem.

Edit: My issue ended up being an ill-configured .graphqlconfig.yml file.


#3

I’m also labouring under the same issue.
@Josiah_Nunemaker - any chance of sharing your solution?

Thanks


#4

Hey together, you can find some examples and upgrading information for prisma-binding and code generation (graphql prepare vs. graphql codegen) plus the accompanying .graphqlconfig.yml file here: https://www.prisma.io/docs/reference/prisma-bindings/code-generation-cosha9rah3/ :slight_smile:

Additionally, there seems to be an issue with post deployment hooks on Windows. This is separately tracked here: https://github.com/prismagraphql/prisma/issues/2494


#5

In my particular case, I had a mistake here

prisma:
    schemaPath: src/generated/prisma.graphql
    extensions: prisma/prisma.yml # This line

Should be more like this

prisma:
    schemaPath: src/generated/prisma.graphql
    extensions: 
      prisma: prisma/prisma.yml

After fixing that, it worked fine.


#6

What operating system and version are you using?

Because it seems Windows may be the contributing factor.


#7

@Josiah_Nunemaker and @nilan Thanks for the information guys.

My issue ended up being a combination of issues as follows

  1. as mentioned by nilan - my prisma-binding was installed as 2.0.1 and I hadn’t noticed when I did the installation so my prisma.yml file needed to be as follows:

     projects: 
       session_api:
          schemaPath: api/schema.graphql
          extensions:
            endpoints:
               session: http://localhost:4000
       prisma_api:
          schemaPath: api/generated/prisma.graphql
          extensions:
             prisma: prisma.yml
             codegen:
                generator: prisma-binding
                language: javascript
                output:
                    binding: api/generated/prisma.js
    
  2. I had previously created an empty prisma.graphql file in api/generated and this file was causing an “Unexpected EOF” error when running “prisma deploy”. Lesson here is to let prisma deploy create the file from scratch.

  3. After these 2 steps the “prisma deploy” command worked and generated the prisma.graphql file. BTW - not sure what t do with the Prisma Module created in prisma.js (if anything) - guidance here would be appreciated.

  4. Despite the success of 1 and 2 above “nodemon -e js,graphql -x node --inspect -r dotenv/config api/index.js” (otherwise known as “yarn debug” :slight_smile: ) was still giving me an error " type Type could not be found in any schemas".
    It turns out that the first line of my schema.graphql file (the one which represents the app surface rather than the prisma surface) needs to have an import which points to the generated prisma.graphql.
    The gotcha for me here is that the import line looks like a comment in that it starts with a “#” and I was disregarding it as being unnecessary when I found it in the example boilerplate code.

Lesson here is to add an import line like

’ # import SchemaType from “./generated/prisma.graphql” ’

to the top of your schema.graphql. Note that the inverted commas seem to be required around the path.


#8

We deployed a release today that makes graphql codegen more robust.

Please install the new cli via npm install -g graphql-cli and try the graphql codegen command.

Note that with prisma-binding 1.x, we need to use graphql prepare
and with prisma-binding 2.x, we need to use graphql codegen

Documentation for codegen.

Thanks!


#9

We are aware that prisma deploy won’t call the hooks on windows yet but running the graphql codegen command manually should work.


#10

Yes, I’ve already made the change and it’s working, so thanks for that.

Is there an ETA when prisma deploy will be updated?


#11

Rough ETA is Tuesday, following the new release process.

You can follow this issue - https://github.com/prismagraphql/prisma/issues/2494

I will only close it once we have prisma deploy resolved on windows.


#12

! Invalid prisma.yml file
! prisma.yml should NOT have additional properties. additionalProperty: endpoint

Get in touch if you need help: https://www.graph.cool/forum
To get more detailed output, run $ export DEBUG="*"

i am getting this error every time i am ruuning “prisma deploy”


#13

Show your prisma.yml file, also update your prisma and graphql-cli globally.


#14

#service: hello-world
#stage: dev

datamodel: datamodel.graphql

to enable auth, provide

secret: my-secret

disableAuth: true
#cluster: vivekmahato26-4b6e4b/prisma-us1
endpoint: https://us1.prisma.sh/vivekmahato26-4b6e4b/hello-world/dev


#15

i have installed latest prisma ,prisma-cli and graphql using npm


#16

This is where it’s slightly different, as I use a local database, but anyhow - I don’t think you need stage and service anymore.

Here’s the boilerplate prisma.yml:


#17

I tried with boilerplate code as well as tried to connect with a local mysql database but still i got the same error.


#18

I think it’s the prisma-cli package, it’s not in use anymore and probably contains a dependency to an old graphql-config-extension-ptisma version.


#19

How to resolve the issue…?


#20

Alright, do you have it up on Github, we can then clone it and give it a spin?