Prisma1: Prisma deploy is not generating a prisma.graphql file

Created on 12 Nov 2018  Â·  13Comments  Â·  Source: prisma/prisma1

I have initiated a project using prisma-cli . It has provided me with a datamodel.prisma file which I changed to datamodel.graphql file but after deploying the project it won't give me a generated prisma.graphql file .

My prisma.yml file

endpoint: "my_valid_prisma_endpoint"
datamodel: datamodel.graphql

hooks:
  post-deploy:
    - graphql get-schema -p database
    - graphql codegen

My datamodel.graphql file

type User {
  id: ID! @unique
  name: String!
  email: String!
  firstName: String
  lastName: String
  password: String
}

My .graphqlconfig.yml file

projects:
  main:
    schemaPath: "lib/schema.graphql"
    extensions:
      endpoints:
        default: "http://localhost:8000"
  database:
    schemaPath: "src/prisma.graphql"
    extensions:
      prisma: prisma.yml

I should get a prisma.graphql file generated under the src folder but I am not getting .
Note that : when I initiated the project I did not generate anything . I choose the Don't generate option . But how can I get the expected prisma.graphql file ?? :thinking: :thinking: :thinking:

statustale

Most helpful comment

Came across this as well and managed to get it working. You still need the post deploy hook in your config or else it won't work. My full prisma.yml is as follows:

endpoint: "my_valid_prisma_endpoint"
datamodel: datamodel.prisma

generate:
  - generator: graphql-schema
    output: ../generated/prisma
  - generator: javascript-client
    output: ../generated/prisma

hooks:
  post-deploy:
    - prisma generate

All 13 comments

It is the output when I run prisma deploy

Deploying service `prisma-blog` to stage `dev` to server `prisma-eu1` 2.2s
Service is already up to date.

post-deploy:
Running graphql get-schema -p prisma ✔
Running graphql codegen ✔

Thanks for asking @pacifio !
Renaming the datamodel.prisma to datamodel.graphql is totally fine and legit.

The "new" way of getting the schema is using the following prisma.yml file:

endpoint: "my_valid_prisma_endpoint"
datamodel: datamodel.graphql

generate:
  - generater: graphql-schema
    output: ./src/generated/

It will create the file ./src/generated/prisma.graphql for you, including the API Schema.

Let me know if this solved your problem. If not, I can reopen this issue :)

It's not working @timsuchanek

I added the following ...

...
generate:
  - generater: graphql-schema
    output: ./src/generated/
...

But still it's not generating

Thanks @pacifio ! When you execute prisma -v - which version is shown? The latest version is 1.20.5

I stumbled on this issue because I had a similar difficulty. I noticed you had a typo @pacifio, you wrote "generater" instead of "generator". Might want to fix that and try it again.

I am also running into this issue when attempting to generate a schema file. The script completes fine, but no file is generated. I followed everything mentioned above. Here is my prisma.yml and datamodel.prisma

endpoint: ${env:PRISMA_ENDPOINT}
datamodel: datamodel.prisma

generate:
  - generator: graphql-schema
    output: ./src/generated/
type Deck {
  id: ID! @unique
  deckName: String!
  deckCommander: String!
  elo: Float!
  rank: Int!
  totalGames: Int!
  gamesWon: Int!
  gamesLost: Int!
  winPercentage: Float!
  createdAt: DateTime!
  updatedAt: DateTime!
}

EDIT: until this ticket gets resolved. Reverting back to an older version of prisma and graphql solved the issue for me.

Came across this as well and managed to get it working. You still need the post deploy hook in your config or else it won't work. My full prisma.yml is as follows:

endpoint: "my_valid_prisma_endpoint"
datamodel: datamodel.prisma

generate:
  - generator: graphql-schema
    output: ../generated/prisma
  - generator: javascript-client
    output: ../generated/prisma

hooks:
  post-deploy:
    - prisma generate

this worked for me

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

Thank the gods.

I run into so many problems when I use walk throughs with deprecated code.
(shame on me)
But i've been on this for a solid 2 hours.

Thank you

worked for me

Thank you so much for this. I was pulling my hair out.

So, if you have a warning like:

â–¸ Error: output for generator graphql-schema should be a .graphql-file.
â–¸ Please change the output property for this generator in prisma.yml

Just create a file /src/generated/prisma.graphql
Thanks work for me!

@balabukha I did something similar, but I did it by explicitly adding the file name in the yaml

generate:
  - generator: javascript-client
    output: ../src/generated/prisma-client
  - generator: graphql-schema
    output: ../src/generated/schema.graphql # <--schema.graphql

You may want to eplicitly add it too. That way if it ever gets deleted your post-deploy hook can recreate it for you 😃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thomaswright picture thomaswright  Â·  3Comments

marktani picture marktani  Â·  3Comments

MitkoTschimev picture MitkoTschimev  Â·  3Comments

schickling picture schickling  Â·  3Comments

sorenbs picture sorenbs  Â·  3Comments