Unable to update GraphQL schema

Hello,

I am unable to update my GraphQL schema. It always returns Instance data is not valid. Not a major deal but forces me to override the schema and recreate roles etc…

Some examples:

type Query {
  accountsByEmail(email: String!): [Account!]!
  + resetRequestByToken(token: String!): [ResetRequest!]!
}

type Mutation {
  register(email: String!, password: String!): Account! @resolver
  login(email: String!, password: String!): String! @resolver
  resetPasswordRequest(email: String!): ResetRequest! @resolver
  + resetPassword(token: String!, password: String!): String! @resolver
}

Have tried deleting the database and starting fresh but same thing occurs. First schema upload works fine then subsequent updates return Instance data is not valid.

Thanks in advance

Does the discussion in this previous topic help?

I noted that I sometimes get the instance not valid error in the dashboard but not when uploading from a shell/script.

I am thinking that it is possible with the greater than 128 documents. The dashboard might be trying to work with the data before the index is ready. this is an absolute guess! But I really don’t know. :man_shrugging:

Also double checking…
Is ResetRequest a collection? (as opposed to embedded type) and
Is token actually a field in ResetRequest documents?

Thanks for your assistance. I saw that thread but both of those didn’t seem to apply unless I am missing something.

  • I don’t believe my example above was modifying an existing index
  • All the collections were empty but Account which had 2 documents within

One thing I haven’t tried is uploading from a shell/script I have been using the dashboard.

Yup ResetRequest is a collection:

type ResetRequest {
  account: Account! @relation
  token: String!
}

When the user makes a forgot password request it creates a ResetRequest that contains the account ref and secret from a Token(). This is my first time working with FaunaDB so feel free to give advice if there is a better way.

@0xhjohnson can you please share the original schema file that you imported and the schema file that you’re trying to update ?

@Jay Quick question when updating a schema do I need to provide the entire schema or just the stuff that has changed? I assumed it was the former and was providing the original schema plus changes to the update.

@0xhjohnson, when you update schema file (merge or override mode) you have to provide entire schema file. Otherwise, schema parsing will fail.
You can find more info here on different modes of updating schema file.

@Jay-Fauna okay that is what I thought. I will provide a concrete example next time I try to update the schema.

Looks like this was an issue with schema upload from within the UI dashboard. Uploading the schema via a normal curl request worked no problem :woman_shrugging: