amplify-cli: Missing/broken resolvers for createdAt and updatedAt

Describe the bug The CLI automatically generates a subscription, including the createdAt and updatedAt fields, but when triggered, GraphQL returns errors “Cannot return null for non-nullable type ‘AWSDateTime!’…”

Given this type isn’t in my schema, I can’t even control it.

Amplify CLI Version 4.21.1

To Reproduce Follow this workshop up until this step, but make sure to use the latest Amplify version.

It should fail at the last instruction on the linked page; “Try uploading another photo”

Expected behavior createdAt and updatedAt are resolved correctly.

Desktop (please complete the following information):

  • OS: Windows
  • Node Version: 12.16.3

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 21 (6 by maintainers)

Most upvoted comments

I can confirm the issue. I have a subscription for an onCreate Event that looks like this:

subscription OnCreateProject {
    onCreateProject {
      id
      number
      name
      description
      createdAt
      updatedAt
    }
  }

In the DynamoDB Table the fields createdAt and updatedAt get correctly populated by the resolvers but in my frontend I get the “Cannot return null […]” error mentioned by @FizzBuzz791. Everything works fine if I remove createdAt and updatedAt from the subscription.

Amplify Version 4.26.0