Instance data is not valid

I have read through:


which covers this issue, despite having a different header.
I have this issue on a new child db I have called ‘test’ (I also get the error with the parentdb) and I therefore supply the requested data, for reviewing this issue, below:

Map(Paginate(Databases()), Lambda("x",Get(Var("x"))))
Map(Paginate(Collections()), Lambda("x",Get(Var("x"))))
Map(Paginate(Indexes()), Lambda("x",Get(Var("x"))))
Map(Paginate(Functions()), Lambda("x",Get(Var("x"))))

{
  data: [
    {
      ref: Ref(Ref("functions"), "all_user_names"),
      ts: 1599619167500000,
      name: "all_user_names",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Query",
            field: {
              name: "allUserNames",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "all_user_names",
                    paginated: false
                  }
                }
              ],
              type: {
                NotNull: {
                  List: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                }
              }
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function all_user_names was not implemented yet. Please access your database and provide an implementation for the all_user_names function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "all_player_challenger_addresses"),
      ts: 1599619167500000,
      name: "all_player_challenger_addresses",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Query",
            field: {
              name: "allPlayerChallengerAddresses",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "all_player_challenger_addresses",
                    paginated: false
                  }
                }
              ],
              type: {
                NotNull: {
                  List: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                }
              }
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function all_player_challenger_addresses was not implemented yet. Please access your database and provide an implementation for the all_player_challenger_addresses function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "create_new_player"),
      ts: 1599619167500000,
      name: "create_new_player",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Mutation",
            field: {
              name: "createNewPlayer",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "create_new_player",
                    paginated: false
                  }
                }
              ],
              type: {
                NotNull: {
                  Named: "Player"
                }
              },
              arguments: [
                {
                  name: "active",
                  type: {
                    NotNull: {
                      Named: "Boolean"
                    }
                  }
                },
                {
                  name: "address",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                },
                {
                  name: "rank",
                  type: {
                    NotNull: {
                      Named: "Int"
                    }
                  }
                },
                {
                  name: "challengeraddress",
                  type: {
                    Named: "String"
                  }
                }
              ]
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function create_new_player was not implemented yet. Please access your database and provide an implementation for the create_new_player function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "all_userjoinedranking"),
      ts: 1599619167500000,
      name: "all_userjoinedranking",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Query",
            field: {
              name: "allUserJoinedRanking",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "all_userjoinedranking",
                    paginated: false
                  }
                }
              ],
              type: {
                List: {
                  Named: "UserJoinedRanking"
                }
              }
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function all_userjoinedranking was not implemented yet. Please access your database and provide an implementation for the all_userjoinedranking function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "create_new_userjoinedranking"),
      ts: 1599619167500000,
      name: "create_new_userjoinedranking",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Mutation",
            field: {
              name: "createNewUserJoinedRanking",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "create_new_userjoinedranking",
                    paginated: false
                  }
                }
              ],
              type: {
                NotNull: {
                  Named: "UserJoinedRanking"
                }
              },
              arguments: [
                {
                  name: "active",
                  type: {
                    NotNull: {
                      Named: "Boolean"
                    }
                  }
                },
                {
                  name: "rankingid",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                },
                {
                  name: "rankingname",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                },
                {
                  name: "useraddr",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                },
                {
                  name: "rankingowneraddr",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function create_new_userjoinedranking was not implemented yet. Please access your database and provide an implementation for the create_new_userjoinedranking function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "all_rankings"),
      ts: 1599619167500000,
      name: "all_rankings",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Query",
            field: {
              name: "allRankings",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "all_rankings",
                    paginated: false
                  }
                }
              ],
              type: {
                List: {
                  Named: "Ranking"
                }
              }
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function all_rankings was not implemented yet. Please access your database and provide an implementation for the all_rankings function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "all_player_ranks"),
      ts: 1599619167500000,
      name: "all_player_ranks",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Query",
            field: {
              name: "allPlayerRanks",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "all_player_ranks",
                    paginated: false
                  }
                }
              ],
              type: {
                NotNull: {
                  List: {
                    NotNull: {
                      Named: "Int"
                    }
                  }
                }
              }
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function all_player_ranks was not implemented yet. Please access your database and provide an implementation for the all_player_ranks function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "all_players"),
      ts: 1599619167500000,
      name: "all_players",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Query",
            field: {
              name: "allPlayers",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "all_players",
                    paginated: false
                  }
                }
              ],
              type: {
                List: {
                  Named: "Player"
                }
              }
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function all_players was not implemented yet. Please access your database and provide an implementation for the all_players function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "all_player_addresses"),
      ts: 1599619167500000,
      name: "all_player_addresses",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Query",
            field: {
              name: "allPlayerAddresses",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "all_player_addresses",
                    paginated: false
                  }
                }
              ],
              type: {
                NotNull: {
                  List: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                }
              }
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function all_player_addresses was not implemented yet. Please access your database and provide an implementation for the all_player_addresses function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "all_users"),
      ts: 1599619167500000,
      name: "all_users",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Query",
            field: {
              name: "allUsers",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "all_users",
                    paginated: false
                  }
                }
              ],
              type: {
                List: {
                  Named: "User"
                }
              }
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function all_users was not implemented yet. Please access your database and provide an implementation for the all_users function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "create_new_ranking"),
      ts: 1599619167500000,
      name: "create_new_ranking",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Mutation",
            field: {
              name: "createNewRanking",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "create_new_ranking",
                    paginated: false
                  }
                }
              ],
              type: {
                NotNull: {
                  Named: "Ranking"
                }
              },
              arguments: [
                {
                  name: "active",
                  type: {
                    NotNull: {
                      Named: "Boolean"
                    }
                  }
                },
                {
                  name: "rankingname",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                },
                {
                  name: "rankingdesc",
                  type: {
                    Named: "String"
                  }
                },
                {
                  name: "rankingowneraddr",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function create_new_ranking was not implemented yet. Please access your database and provide an implementation for the create_new_ranking function."
          )
        )
      )
    },
    {
      ref: Ref(Ref("functions"), "create_andor_login_user"),
      ts: 1599619167500000,
      name: "create_andor_login_user",
      data: {
        gql: {
          ts: Time("2020-09-09T02:39:27.306193Z"),
          meta: {
            location: "Mutation",
            field: {
              name: "createAndOrLoginUser",
              directives: [
                {
                  name: "resolver",
                  args: {
                    name: "create_andor_login_user",
                    paginated: false
                  }
                }
              ],
              type: {
                NotNull: {
                  Named: "String"
                }
              },
              arguments: [
                {
                  name: "active",
                  type: {
                    NotNull: {
                      Named: "Boolean"
                    }
                  }
                },
                {
                  name: "username",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                },
                {
                  name: "password",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                },
                {
                  name: "ethaddress",
                  type: {
                    NotNull: {
                      Named: "String"
                    }
                  }
                },
                {
                  name: "description",
                  type: {
                    Named: "String"
                  }
                },
                {
                  name: "email",
                  type: {
                    Named: "String"
                  }
                },
                {
                  name: "mobile",
                  type: {
                    Named: "String"
                  }
                }
              ]
            }
          }
        }
      },
      body: Query(
        Lambda(
          "_",
          Abort(
            "Function create_andor_login_user was not implemented yet. Please access your database and provide an implementation for the create_andor_login_user function."
          )
        )
      )
    }
  ]
}

>> Time elapsed: 48ms

The Schema:

type User 
 {  
    active : Boolean!
    username : String! @unique
    password : String! @unique
    ethaddress : String! @unique
    description : String
    email : String @unique 
    mobile : String @unique
    member_since: Int!
}

type Player 
 {  address : String! @unique
    rank : Int!
    challengeraddress : String
}

type Ranking
  { 
    active : Boolean!
    rankingname : String! @unique
    rankingdesc : String
    rankingowneraddr : String! @unique
    }

type UserJoinedRanking
  { 
    active : Boolean!
    rankingid : String!
    rankingname : String!
    useraddr : String!
    rankingowneraddr : String!
    }


type Mutation {
  createAndOrLoginUser(active: Boolean!, username: String!, password: String!, ethaddress: String!, description: String, email: String, mobile: String): String! @resolver(name: "create_andor_login_user")
  createNewPlayer(active: Boolean!, address: String!, rank: Int!, challengeraddress: String): Player! @resolver(name: "create_new_player")
  createNewRanking(active: Boolean!, rankingname : String!, rankingdesc : String, rankingowneraddr : String!): Ranking! @resolver(name: "create_new_ranking")
  createNewUserJoinedRanking(active: Boolean!, rankingid : String!, rankingname : String!, useraddr: String!, rankingowneraddr : String!): UserJoinedRanking! @resolver(name: "create_new_userjoinedranking")
}

type Query {
  allUserNames: [String!]! @resolver(name: "all_user_names")
  allPlayerAddresses: [String!]! @resolver(name: "all_player_addresses")
  allPlayerRanks: [Int!]! @resolver(name: "all_player_ranks")
  allPlayerChallengerAddresses: [String!]! @resolver(name: "all_player_challenger_addresses")
  allPlayers: [Player] @resolver(name: "all_players")
  allRankings: [Ranking] @resolver(name: "all_rankings")
  allUserJoinedRanking: [UserJoinedRanking] @resolver(name: "all_userjoinedranking")
  allUsers: [User] @resolver(name: "all_users")
  usernameFromEthaddress: [String!]!
}


What changes do I need to make to my configurations (schema or otherwise) to enable regular schema updates (parent and child dbs) without further complications (if possible), to avoid this error? thanks …

@FreeRoss Thanks for bringing this to our attention. I was able to repro this issue with your schema file. The error is coming from the query.

usernameFromEthaddress: [String!]!

Looks like you are missing an input type and @resolver directive.
Something like this if you were expecting a list of username for a given ethaddress.

usernameFromEthaddress(ethaddress: String!): [String!]! @resolver(name: "usernameFromEthaddress")

1 Like

Thanks @Jay-Fauna. For practical purposes that fixed it when I upload the schema from my project terminal. However, the UI still gives the ‘Instance data is not valid.’ error when I attempt to update the schema via the web UI.
I can work with it for now, but I presume you will want to determine what’s causing the UI problem to avoid future issues on this matter.

@FreeRoss, If you were able to import through project terminal successfully then you should be able to import from UI too. Can you please double check if its the same schema file ?

@Jay-Fauna, I tried it again with same message today. I only have 1 project and 1 schema file. There is no other file for me to confuse it with. I copied the file path and viewed the same schema from my file system, rather than from the browser dialogue used by the UI, as an extra check.
If it’s any help my Chrome version is:
Version 84.0.4147.105 (Official Build) (64-bit)
Under Linux Mint 18.3
Don’t worry about me on this issue, I can work with the terminal. But I’m happy to assist with any further details you may require to fix the in browser behavior which might generate a lot unnecessary support tickets …

Are there any new indexes being created? I’ve also experienced that the UI causes this error while uploading from the Dashboard but does return errors while uploading from a script/terminal.

I’ve mentioned this several places on the forums and no one has challenged me on that. @Jay-Fauna ‘s comment here that it shouldn’t happen would be the first.

Hi @ptpaterson. I had created new indexes and I attempted to specify them correctly in the schema. It required Jay’s addition of @resolver to get it right.
Yes, I believe I saw your posts which were helpful when I came across the same issue. Although, for now, for this specific error, it appears to be a straightforward (from a user’s perspective) UI problem to be ignored until it’s fixed …

@FreeRoss @ptpaterson Thanks a mil for your inputs. I have created a low priority ticket for Front End team to take a look. Meanwhile, if you come across this issue again, please try to take a copy of browser logs from Developer Tools and retry clearing Application Cache in browser. Something like below.

Hi @Jay-Fauna

I have cleared the application cache in browser.
Here is a copy of browser logs from Developer Tools after attempting to import the schema:


Please note that clicking ‘Play’ in Playground doesn’t now appear to do anything for some of my commands (one simple query with a Basic auth works as before). Please let me know if there’s an obvious reason based on above (e.g. clear app cache) and what I should do to fix? If it persists I can post this as a separate issue …
Thanks …

@FreeRoss were you able to solve this ?

@Jay-Fauna No. I just tried again with a successful schema upload and import from a terminal within VSCode. But I still get ‘instance data is not valid’ from the Fauna UI on ‘update schema’.
Whilst it would be nice if this issue was resolved it is currently a low priority for me as it isn’t materially affecting my development.
However, @Luigi_Servini has been helping me with
https://forums.fauna.com/t/re-auto-created-query-returns-null/660/6
and I am not currently sure how to proceed. The query in question is fundamental to the operation of my app and currently I cannot get it to work with a user specific token (it works with a key) in the Playground. It’s possible I can get it to work directly from the app, but I’m not yet in a position to try that. It would be re-assuring to get it working in the Playground first, which, I believe, is the purpose of the Playground. If you can assist in this issue in any way that would be very helpful … thanks …

This issue persists. Despite the UI problem (get the error using UI interface), I have been able to upload via VSCode … until today, wherein I get the same error in my client terminal. One observation is that it is a very generic and unhelpful error message giving no clue as to the source (client/server? syntax? datatypes? etc.) of the problem. Another aspect is that the schema is at the heart of everything the system does, so the inability to update it acts a serious limitation on development. I am attempting to resolve another issue that requires a schema update
however, I cannot progress with that, and other issues, whilst this problem persists …

I have run into this issue whenever I accidentally named one of my types or one of my Queries/Mutations the same name as one that Fauna is trying to automatically generate on the upload. When the schema is being uploaded, Fauna will automatically parse and attempt to understand your intentions and then autogenerate things such as Page types and CRUD operations.

Any type that is not using the @embedded directive is expected to correspond either by exact name or matched by using the @collection directive to a Collection in your Fauna database. This allows fauna to automatically generate most CRUD operations corresponding to documents going into that collection. This is very confusing at first because what it means is that the schema that you are uploading is not ultimately the schema Fauna will use.

My recommendation is to go into the GraphQL Playground in your Fauna dashboard and then click on the Schema tab on the far right of the screen. That is the current actual schema Fauna has generated using your upload. Go through there and see if there are any naming collisions with the new additions you are trying to upload now. If not, Fauna could still be trying to generate something on upload based on your changes that is causing a naming collision and so you will need to check for that as well.

Any Fauna folks who read through this I would like to take this opportunity to recommend that autogenerated names be appended somehow or maybe just use some notes on the generated Schema file so that we can tell at a glance what happened to our schema post upload.

1 Like

@yellowspaceboots
Thanks very much for your response and pointers.

After some tinkering, I defined all the types in the client schema as @embedded and successfully uploaded (it still didn’t work from the UI, but that’s another issue).

Going forward I will bear the ‘naming collisions’ issue in mind.

I will address the ‘data vector’ issue there

For the reasons detailed here I deleted the database and I no longer update the schema from within VSCode. This problem is therefore currently ‘solved’ with my current setup.
I think the explanations given by @yellowspaceboots in the thread above (and elsewhere) help to appreciate how this problem may arise in the first instance.

1 Like