Prisma1: Improve "The schema is invalid: Invalid field type definition detected." error message

Created on 12 Oct 2017  路  12Comments  路  Source: prisma/prisma1

Noticing an issue with the CLI. After I successfully deploy to a production environment for the first time, a second push triggers a schema not found error. Here are the steps to reproduce along with info from debug window. (Note: All this is test data so there should not be any worries on sensitive data.)

  1. graphcool deploy --new-service EmreAuthDev4
  2. more .graphcoolrc #find the target for the newly created service
  3. graphcool deploy --target prod1

This deployment does have a custom resolver function defined in the YAML file.

bu2-confirmed aredeploy

Most helpful comment

Yes. The CLI will group it under the type that the offending fields belong to.

bildschirmfoto 2017-11-01 um 19 21 38

All 12 comments

Could you please share the content of your graphcool.yml file? Also, this is the error message:

The schema is invalid: Invalid field type definition detected. Valid field type formats: Int, Int!, [Int!], [Int!]! for example.

types: ./types.graphql

functions:
  authConsentUrl:
    handler:
      code:
        src: src/auth/consentUrl.js
    type: resolver
    schema: src/auth/consentUrl.graphql
permissions:
- operation: File.read
- operation: File.create
- operation: File.update
- operation: File.delete
- operation: Profile.read
- operation: Profile.create
- operation: Profile.update
- operation: Profile.delete
- operation: User.read
- operation: User.create
- operation: User.update
- operation: User.delete
- operation: UserProfiles.*
rootTokens:
- vyrlAuthService

Sorry, I meant the types.graphql 馃槃

type File implements Node {
  contentType: String!
  createdAt: DateTime!
  id: ID! @isUnique
  name: String!
  secret: String! @isUnique
  size: Int!
  updatedAt: DateTime!
  url: String! @isUnique
}

type User implements Node {
  id: ID! @isUnique
  createdAt: DateTime!
  updatedAt: DateTime!
  profiles: [Profile] @relation(name: "UserProfiles")
  roles: [UserRole!]
}

type Profile implements Node {
  id: ID! @isUnique
  user: User @relation(name: "UserProfiles")
  status: String!
  csrf: String!
  provider: String!
  providerId: String!
  accessData: Json
  profileData: Json
  createdAt: DateTime!
  updatedAt: DateTime!
}

enum UserRole {
  FOLLOWER
  MODERATOR
  INFLUENCER
  ADMIN
}

enum AccessGroupOperation {
  READ
  UPDATE
  DELETE
  CREATE
}

Interesting, I don't know why this validation doesn't work for the first deploy, but [Profile] is not supported, it should be [Profile!]!.

@do4gr, the error message in this case is not accurate. For relations, [Profile!] is not supported, it needs to be [Profile!]!.

@resonantfreq, could you try [Profile!]! instead of [Profile]? 馃檪

That seems to be the issue. I am able to redeploy consistently now. Thanks for the quick response!

Great! Sorry for the inconvenience, the error message should be different for the case of a relational field.

While you're at it, also add [TypeName]:[fieldName] to that error message please.

This is fixed now. The error message should look like this now: The relation field 'posts' has the wrong format: '[Post!]' Possible Formats: 'Post', 'Post!', '[Post!]!'

Wrong formats for non-relation fields should return a similar error message with the possible formats.

Does the error message also specify the Type name?

Yes. The CLI will group it under the type that the offending fields belong to.

bildschirmfoto 2017-11-01 um 19 21 38

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fi1osof picture Fi1osof  路  3Comments

marktani picture marktani  路  3Comments

marktani picture marktani  路  3Comments

ragnorc picture ragnorc  路  3Comments

dohomi picture dohomi  路  3Comments