parse-community / Parse-SDK-Flutter

The Dart/Flutter SDK for Parse Platform
https://parseplatform.org
Apache License 2.0
575 stars 189 forks source link

the SDK will crash if the batch response returns an error if one or more of the batch requests fail #853

Closed Nidal-Bakir closed 1 year ago

Nidal-Bakir commented 1 year ago

New Issue Checklist

Issue Description

When sending the batch request if the server returns an error for one or more batch requests the SDK will crash with the error" type 'Null' is not a subtype of type 'int'

Steps to reproduce

  1. create ParseObject planObject
  2. set objectId to any value so the server will return 101 not found error
  3. create ParseObject dietPlansObject
  4. set the planObject object as a child object for dietPlansObject object
  5. call save() on the container object dietPlansObject
 final planObject = ParseObject('Plans')
          ..objectId = "000000" // so the server will return 101 not found error
          ..set('PlanName', 'plan 1');

 final dietPlansObject = ParseObject("Diet_Plans");

 dietPlansObject.set('Plan1', planObject);

 await dietPlansObject.save();

Actual Outcome

Error type 'Null' is not a subtype of type 'int'

Expected Outcome

The container object and its child object to be saved

Environment

Parse Flutter SDK

Server

Logs

package:parse_server_sdk/src/objects/response/parse_response_builder.dart 76:35 _ParseResponseBuilder._handleSuccess package:parse_server_sdk/src/objects/response/parse_response_builder.dart 29:14 _ParseResponseBuilder.handleResponse package:parse_server_sdk/src/objects/response/parse_response_utils.dart 8:31 handleResponse package:parse_server_sdk/src/utils/parse_utils.dart 97:12 batchRequest ===== asynchronous gap =========================== package:parse_server_sdk/src/objects/parse_object.dart 185:40 ParseObject._saveChildren ===== asynchronous gap =========================== package:parse_server_sdk/src/objects/parse_object.dart 112:44 ParseObject.save ===== asynchronous gap =========================== test/src/objects/parse_object/parse_object_save_test.dart 404:26 main..

type 'Null' is not a subtype of type 'int'

parse-github-assistant[bot] commented 1 year ago

Thanks for opening this issue!

mtrezza commented 1 year ago

I unassigned this issue from you. We deliberately do not make use the assignment feature.