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

ParseUser.save fails when user is logged in #819

Closed
gorillatapstudio opened this issue Feb 3, 2023 · 13 comments · Fixed by #822
Closed

ParseUser.save fails when user is logged in #819

gorillatapstudio opened this issue Feb 3, 2023 · 13 comments · Fixed by #822
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@gorillatapstudio
Copy link

New Issue Checklist

Issue Description

When using the 3.1.12, as long as the user is signed in, user.save() results in save failed error. null is not an int.
When switched back to 3.1.11, the error is gone.
I have switched back and force twice to validate the issue.

Steps to reproduce

upgrade the sdk to 3.1.12, user log in, use debug mode

Actual Outcome

Expected Outcome

Environment

Parse Flutter SDK

  • SDK version: 3.7.0
  • Operating system version: FILL_THIS_OUT

Server

  • Parse Server version: FILL_THIS_OUT

Logs

@parse-github-assistant
Copy link

parse-github-assistant bot commented Feb 3, 2023

Thanks for opening this issue!

  • ❌ Please fill out all fields with a placeholder FILL_THIS_OUT, otherwise your issue will be closed. If a field does not apply to the issue, fill in n/a.

@mtrezza mtrezza changed the title parse_server_sdk: 3.1.12 introduced a new bug for user.save() Bug for user.save() Feb 3, 2023
@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Feb 3, 2023
@mbfakourii
Copy link
Member

I checked, there is no problem. This error occurs when you timeout. Please check if there is access to the server.

my parse response

-- Parse Request
curl -X POST -H 'X-Parse-Revocable-Session: 1' -H 'X-Parse-Installation-Id: ---' -H 'user-agent: Flutter Parse SDK 3.1.12' -H 'X-Parse-Application-Id: ----' -H 'X-Parse-Client-Key: ----' https://parseapi.back4app.com/classes/_User

 https://parseapi.back4app.com/classes/_User---- Parse Response
Class: _User
Function: ParseApiRQ.signUp
Status Code: 201
Payload: {"className":"_User","objectId":"I49l5SKBPX","createdAt":"2023-02-03T15:15:11.860Z","username":"te424s24453t22","email":"asdas4qq342dmb2@asd.ccc","sessionToken":"r:b68e8ae664e802189f2931c3917bb5c3"}
╰-- 

As you can see in my response, I am using the Flutter Parse SDK 3.1.12 version

@gorillatapstudio
Copy link
Author

Thanks for the quick reply! My user object has several child objects which are probably causing the failure.
I verified this issue using several of my apps with different parse instances. Additionally, I never had this failure until the upgrade to 3.1.12.
I am wondering if the 3.1.12 handles the nullable field of the object differently than before.
If you need more info, I can do more debug when i have a chance.

@mbfakourii
Copy link
Member

Thanks for the quick reply! My user object has several child objects which are probably causing the failure. I verified this issue using several of my apps with different parse instances. Additionally, I never had this failure until the upgrade to 3.1.12. I am wondering if the 3.1.12 handles the nullable field of the object differently than before. If you need more info, I can do more debug when i have a chance.

Yes, I would appreciate it if you could send a sample code

@gorillatapstudio
Copy link
Author

when calling user.save() exception in parse_response_builder.dart / _handleSuccess.
The user object has many children in it as follows.
Screenshot 2023-02-03 at 4 11 32 PM

The result list has some successful and some as failure
Screenshot 2023-02-03 at 4 12 16 PM

Line 75 catches the exception: final ParseError error = ParseError(
code: objectResult[keyCode],
message: objectResult[keyError].toString());

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

@mbfakourii
Copy link
Member

I made several attempts to generate this error but could not simulate the error.
It is possible to send a sample code that has this problem.

@hgandhi67
Copy link

Same error for me it is happening here

Unhandled Exception: type 'Null' is not a subtype of type 'int'
Screenshot at Feb 08 11-59-19

Screenshot at Feb 08 11-58-57

@mbfakourii
Copy link
Member

Same error for me it is happening here

Unhandled Exception: type 'Null' is not a subtype of type 'int' Screenshot at Feb 08 11-59-19

Screenshot at Feb 08 11-58-57

It is possible to send a sample code that has this problem

@mbfakourii
Copy link
Member

mbfakourii commented Feb 9, 2023

@hgandhi67 @gorillatapstudio
It is possible to test the library as follows

dependency_overrides:
  parse_server_sdk:
    git:
      url: https://github.com/mbfakourii/Parse-SDK-Flutter
      path: packages/dart
      ref: 889bdd878485a4f7c4228cf8f8247043a118ce29

@gorillatapstudio
Copy link
Author

Sorry i am seeing the same error.
I have verified that the pubspec.lock has resolved to the 3.1.12 with overrides.

@gorillatapstudio
Copy link
Author

in the 3.1.12 PR,
it changes _getObjectData()[key] = parseDecode(value);
to _unsavedChanges[key] = _getObjectData()[key];
seems to be a big change to original purpose of the code. i noticed many of my objects becomes having unsavedChanges but they shouldn't be.

@mbfakourii
Copy link
Member

mbfakourii commented Feb 11, 2023

@hgandhi67 @gorillatapstudio It is possible to test the library as follows

dependency_overrides:
  parse_server_sdk:
    git:
      url: https://github.com/mbfakourii/Parse-SDK-Flutter
      path: packages/dart
      ref: 889bdd878485a4f7c4228cf8f8247043a118ce29

In this way, I went back to 3.1.11
Are you sure the problem is not from somewhere else?

@erikas-taroza
Copy link

dependency_overrides:
  parse_server_sdk:
    git:
      url: https://github.com/mbfakourii/Parse-SDK-Flutter
      path: packages/dart
      ref: 889bdd878485a4f7c4228cf8f8247043a118ce29

I ran into this issue today and this override fixed it for me. This issue didn't happen in my release build from a couple weeks ago which is weird (I didn't change anything related to Parse).

@mtrezza mtrezza changed the title Bug for user.save() ParseUser.save fails when user is logged in Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants