Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot return null for non-nullable type: \'AWSDateTime\' within parent (/onUpdateImbybe/createdAt)" #3517

Open
jaymeen-unadkat-differenz opened this issue Feb 13, 2024 · 3 comments
Labels
bug Something isn't working datastore Issues related to the DataStore category pending-triage Issue is pending triage

Comments

@jaymeen-unadkat-differenz

Describe the bug

I'm facing this issue when I hit the save command.

Steps To Reproduce

Steps to reproduce the behavior:
1. Try updating any value by the save command it will give you an error.

Expected behavior

Should work properly.

Amplify Framework Version

2.25.6

Amplify Categories

API

Dependency manager

Swift PM

Swift version

5.9

CLI version

12.10.1

Xcode version

XCode 15

Relevant log output

Got failed result with GraphQL service returned a successful response containing errors: [Amplify.GraphQLError(message: "Cannot return null for non-nullable type: \'AWSDateTime\' within parent \'Imbybe\' (/onUpdateImbybe/createdAt)", locations: nil, path: Optional([Amplify.JSONValue.string("onUpdateImbybe"), Amplify.JSONValue.string("createdAt")]), extensions: nil), Amplify.GraphQLError(message: "Cannot return null for non-nullable type: \'AWSDateTime\' within parent \'Imbybe\' (/onUpdateImbybe/updatedAt)", locations: nil, path: Optional([Amplify.JSONValue.string("onUpdateImbybe"), Amplify.JSONValue.string("updatedAt")]), extensions: nil)]

Is this a regression?

Yes

Regression additional context

No response

Platforms

iOS

OS Version

14.0

Device

Simulator iPhone 11

Specific to simulators

No - Not working anywhere

Additional context

No response

@lawmicha lawmicha added datastore Issues related to the DataStore category bug Something isn't working pending-triage Issue is pending triage labels Feb 13, 2024
@lawmicha
Copy link
Member

Hi @jaymeen-unadkat-differenz, can you provide us with the schema that you used, redacted if needed. Alternatively, you can run

amplify diagnose --send-report

to create a zip of the amplify project which includes the schema. (https://docs.amplify.aws/swift/tools/cli/reference/diagnose/)

Can you also provide us with the code snippet that you are using to perform the save?

Usually createAt and updatedAt are system-level fields on the model, so if you had overridden them in the schema and marked them as required, that may be related to the error you're seeing. We won't know until we have your schema to analyze and reproduce the problem.

@jaymeen-unadkat-differenz
Copy link
Author

jaymeen-unadkat-differenz commented Feb 14, 2024

@lawmicha
This is the schema which we are using

type Imbybe @model @auth(rules: [{allow: public}]){
  pk: String! @primaryKey(sortKeyFields: ["sk"])
  sk: String!
  gsi1: String @index(sortKeyFields: ["gsisk1"])
  gsisk1: String
  name: String
  description: String
  imageURL: String
  ordersEmail: String
  type: String
  street: String
  city: String
  state: String
  zipCode: Int
  productCost: Int
  productCategory: String
  numberOfDrinks: Int
  publishDate: AWSDateTime
  expirationDate: AWSDateTime
  eligibleZipCodes: [Int]
  numberOfCampaigns: Int
  numberOfOffers: Int
  remainingNumberOfCampaigns: Int
  productQuantity: Int
  primaryProduct: Boolean
  startingNumberOfDrinks: Int
  remainingNumberOfDrinks: Int
  lat: Float
  lng: Float
  operatingHours: AWSJSON
  cognitoID: String
  startingNumberOfOffers: Int
  remainingNumberOfOffers: Int
  campaignStatus: String
  rating: Int
  comment: String
}

@lawmicha
Copy link
Member

Thanks for the schema, any code snippets and logs leading up to that error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datastore Issues related to the DataStore category pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants