While testing my Flutter app on the iOS simulator, I came across an issue. It occurred during the execution of Datastore.save, where the mutation failed due to a client error. Below is the Datastore initialization function. In this function, errorHandler is expected to return a message that can be parsed to obtain the error message.
Below is the message I am getting inside errorHandler
AmplifyDataStore(
modelProvider: ModelProvider.instance,
// Error handler for any error occurs during any datastore expression
errorHandler: (error) {
Log('Amplify Config', 'AWS Error: $error');
},
syncExpressions: syncExpression);
Message: GraphQL service returned a successful response containing errors: [Amplify.GraphQLError(message: "The conditional request failed (Service: DynamoDb, Status Code: 400, Request ID: 7083O037M1FTFRK038A4CI9H43VV4KQNSO5AEMVJF66Q9ASUAAJG)", locations: Optional([Amplify.GraphQLError.Location(line: 2, column: 3)]), path: Optional([Amplify.JSONValue.string("createTodo")]), extensions: Optional(["errorType": Amplify.JSONValue.string("Code"), "data": Amplify.JSONValue.null, "errorInfo": Amplify.JSONValue.null]))]
Recovery suggestion: The list of `GraphQLError` contains service-specific messages
Underline exception: The operation couldn’t be completed. (Amplify.GraphQLResponseError<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>> error 0.)
As I deep drive into the amplify_datastore iOS SDK, I noticed that the createSerializedError function below sends an error description, which complicates the process of parsing the error.
Description
While testing my Flutter app on the iOS simulator, I came across an issue. It occurred during the execution of
Datastore.save
, where the mutation failed due to a client error. Below is the Datastore initialization function. In this function,errorHandler
is expected to return a message that can be parsed to obtain the error message.Below is the message I am getting inside errorHandler
As I deep drive into the
amplify_datastore
iOS SDK, I noticed that thecreateSerializedError
function below sends an error description, which complicates the process of parsing the error.Error passed to flutter apps should be in either a map or a json, so that flutter client can parse the error.
Categories
Steps to Reproduce
Screenshots
No response
Platforms
Flutter Version
3.19.0
Amplify Flutter Version
1.7.0
Deployment Method
Amplify CLI
Schema