Prisma1: Post-deploy `graphql get-schema` doesn't generate files

Created on 4 Aug 2018  Â·  9Comments  Â·  Source: prisma/prisma1

I have configured my post-deploy hook to update my database schema automatically. Unfortunately, the files are not being generated. Here is my config:

endpoint: http://localhost:4466
datamodel: datamodel.graphql
hooks:
  post-deploy:
    - graphql get-schema -p prisma
seed:
  import: ./seed.graphql

and the output of prisma deploy

> prisma deploy
Deploying service default to stage default to server local 111ms
Service is already up to date.

post-deploy:
Running graphql get-schema -p prisma √

As you can see logs show success but it's not true.

Running graphql get-schema -p prisma manually works and generates files

  • OS Windows 10
  • prisma/1.13.5 (windows-x64) node-v8.9.4
  • prisma server 1.13
bu0-needs-info statustale

Most helpful comment

In prisma 1.34, the solution shared by @evenmed will throw Error: output for generator graphql-schema should be a .graphql-file.

Replace output: ./src/generated/ with output: ./src/generated/prisma.graphql to avoid the error.

All 9 comments

Can you share the .graphqlconfig.yml file, and your local and global versions of graphql-cli? 🙂

Sure, the graphql config:

projects:
  app:
    schemaPath: src/schema.graphql
    extensions:
      endpoints:
        default: http://localhost:4000
  prisma:
    schemaPath: src/generated/prisma.graphql
    extensions:
      prisma: prisma/prisma.yml
      codegen:
        - generator: prisma-binding
          language: typescript
          output:
            binding: src/generated/prisma.ts

and the graphql-cli version is 2.16.5 for global. I have only global version, haven't installed CLI in my project

I followed the guide here https://www.prisma.io/docs/develop-prisma-service/service-configuration/data-model-knul/

Under one of the section

.graphqlconfig.yml

project:
  db:
    schemaPath: prisma.graphql
    extensions:
      prisma: prisma.yml

example was given, for the longest time I could not figure out why the schema file was not generating for me. It seems that the "project" heading has to be "projects"

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@niba did you find a solution? I ran into the same problem as you yesterday and haven't found a solution yet.

@tzjoke nope, I decided to not use Prisma and graphql because Prisma doesn't support interface inheritance and unions and all of my issues that I reported have been closed by the stale bot

I'm having this issue now. Prisma was working fine along with my post-deploy hook graphql get-schema -p prisma, but since yesterday it just doesn't update the generated file.

This is my .graphqlconfig.yml file:

projects: app: schemaPath: "src/schema.graphql" extensions: endpoints: default: "http://localhost:4444" prisma: schemaPath: "src/generated/prisma.graphql" extensions: prisma: prisma.yml

And this is my prisma.yml:
endpoint: ${env:PRISMA_ENDPOINT} datamodel: datamodel.prisma secret: ${env:PRISMA_SECRET} hooks: post-deploy: - graphql get-schema -p prisma

I haven't changed those files at all, nor have I changed my prisma version or anything similar.

Alright I fixed it based on this answer: https://github.com/prisma/prisma/issues/3469#issuecomment-455955230

I had to change my prisma.yml to:

````
endpoint: ${env:PRISMA_ENDPOINT}
datamodel: datamodel.prisma
secret: ${env:PRISMA_SECRET}
generate:

  • generator: graphql-schema
    output: ./src/generated/
    hooks:
    post-deploy:

    • graphql get-schema -p prisma

    • prisma generate

      ````

Still can't figure out why this error started happening without me changing my prismal or graphql versions, but I'm glad it's fixed now.

In prisma 1.34, the solution shared by @evenmed will throw Error: output for generator graphql-schema should be a .graphql-file.

Replace output: ./src/generated/ with output: ./src/generated/prisma.graphql to avoid the error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikolasburk picture nikolasburk  Â·  3Comments

schickling picture schickling  Â·  3Comments

sedubois picture sedubois  Â·  3Comments

akoenig picture akoenig  Â·  3Comments

schickling picture schickling  Â·  3Comments