AWS graphql Cannot return null for non-nullable type

Describe the bug

Cannot return null for non-nullable type: 'ID' within parent 'Bus' (/listBuss/items2/userId)

To Reproduce

Expected behavior

Subscripts get triggered when new items are created but the returned object is null with the following errors:

0: {path: Array(4), locations: null, message: "Cannot return null for non-nullable type: 'ID' within parent 'Bus' (/listBuss/items2/userId)"}

1: {path: Array(4), locations: null, message: "Cannot return null for non-nullable type: 'ID' within parent 'Bus' (/listBuss/items[4]/userId)"}

2: {path: Array(4), locations: null, message: "Cannot return null for non-nullable type: 'ID' within parent 'Bus' (/listBuss/items[5]/userId)"}

Code Snippet

graphQL schema is as follows - mostly automatically generated by Amplify scripts:

type User @model {
  id: ID!
  username: String!
  email: String!

  orders: [Order] @connection(keyName: "byUser", fields: ["id"])
  bus: Bus @connection(fields: ["id"])
}

type Bus @model
@key(name: "byUser", fields: ["userId"]){
  id: ID!
  type: String!
  latitude: Float,
  longitude: Float,
  heading: Float,
  isActive: Boolean

  orders: [Order] @connection(keyName: "byBus", fields: ["id"])

  userId: ID!
  user: User @connection(fields: ["userId"])
}

type Order @model
 @key(name: "byUser", fields: ["userId"])
 @key(name: "byBus", fields: ["busId", "createdAt"]){
  id: ID!
  createdAt: String!

  type: String!
  status: String,

  originLatitude: Float!
  oreiginLongitude: Float!

  destLatitude: Float!
  destLongitude: Float!

  userId: ID!
  user: User @connection(fields: ["userId"])

  busId: ID!
  bus: Bus @connection(fields: ["busId"])
}

type Subscription {
  onOrderUpdated(id: ID!): Order @aws_subscribe(mutations: ["updateOrder"])
  onBusUpdated(id: ID!): Bus @aws_subscribe(mutations: ["updateBus"])
}

queries.js

export const listBuss = /* GraphQL */ `
  query ListBuss(
    $filter: ModelBusFilterInput
    $limit: Int
    $nextToken: String
  ) {
    listBuss(filter: $filter, limit: $limit, nextToken: $nextToken) {
      items {
        id
        type
        latitude
        longitude
        heading
        isActive
        orders {
          nextToken
        }
        userId
        user {
          id
          username
          email
          createdAt
          updatedAt
        }
        createdAt
        updatedAt
      }
      nextToken
    }
  }
`;

And the React client code

const [bus, setBuses] = useState([]);

  useEffect(() => {
    const fetchBuses = async () => {
      try {
        const response = await API.graphql(
          graphqlOperation(
            listBuss
          )
        )
        
        setBuses(response.data.listBuss.items);
      } catch (e) {
        console.error(e);
      }
    };

    fetchBuses();
  }, [])

Screenshots

debugger - console

debugger - sources

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum