Cannot query field "username" on type "User"
The field doesn’t exist in the GraphQL schema.
Fix 1: Check the schema
# Check what fields are available
type User {
id: ID!
name: String! # ← It's "name", not "username"
email: String!
}
Fix 2: Fix the query
# ❌ Wrong field name
query {
user(id: "1") {
username
}
}
# ✅ Use the correct field
query {
user(id: "1") {
name
}
}
Fix 3: Use introspection
{
__type(name: "User") {
fields {
name
type { name }
}
}
}