'Why does FaunaDB output differ from Graphqli?

I have created a simple user.gql file

type Query {
users: [user]
userById(id:ID!):user
}

type user {
id: ID!
chat_data: String
}

My data is

 [
    {
        "id": "0815960b-9725-48d5-b326-7718c4749cf5",
        "chat_data": ""
    }
]

When I run this on my local server and use the query

{users{id}}

I see the expected output

{
"data": {
    "users": [
    {
        "id": "0815960b-9725-48d5-b326-7718c4749cf5"
    }
    ]
}
}

I have created a user collection on FaunaDB with the data

{
    "ref": Ref(Collection("user"), "324407037973758152"),
    "ts": 1645691670220000,
    "data": {
        "id": "0815960b-9725-48d5-b326-7718c4749cf5",
        "chat_data": ""
    }
}

and uploaded my user.gql, but when I run the GraphQl query

{users{id}}

I get the error

{
    "data": null,
    "errors": [
        {
        "message": "Cannot query field 'id' on type 'userPage'. (line 3, column 5):\n    id\n    ^",
        "locations": [
            {
            "line": 3,
            "column": 5
            }
        ]
        }
    ]
}

What am I doing wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source