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

Calling listUsers throws "Cannot be converted to a deep immutable object: Instance of 'GoogleCloudIdentitytoolkitV1ProviderUserInfo’" #38

Open
livtanong opened this issue Jun 16, 2023 · 3 comments

Comments

@livtanong
Copy link

Running under Windows.

The class definition for GoogleCloudIdentitytoolkitV1ProviderUserInfo cannot be found in firebase_admin. Instead it can be found in a dependency: https://github.com/invertase/dart_firebase_apis/blob/541a555ac378f7fadfdd404f5de04e6898da9523/generated/firebaseapis/lib/identitytoolkit/v1.dart#L3996

Seems like firebase_admin is unexpectedly getting this class rather than raw json data for deserialization.

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument (value): Cannot be converted to a deep immutable object: Instance of 'GoogleCloudIdentitytoolkitV1ProviderUserInfo'
#0      toDeepImmutable
deep_immutable.dart:90
#1      new _DeepImmutableList.<anonymous closure>
deep_immutable.dart:123
#2      MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#3      ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#4      new _List._ofEfficientLengthIterable (dart:core-patch/array.dart:162:27)
#5      new _List.of (dart:core-patch/array.dart:127:20)
#6      new List.of (dart:core-patch/array_patch.dart:49:20)
#7      new List.from (dart:core-patch/array_patch.dart:33:19)
#8      new List.unmodifiable (dart:core-patch/array_patch.dart:67:24)
#9      new _DeepImmutableList
deep_immutable.dart:122
#10     toDeepImmutable
deep_immutable.dart:84
#11     new _DeepImmutableMap.<anonymous closure>
deep_immutable.dart:115
#12     MapBase.map (dart:collection/maps.dart:82:28)
#13     new _DeepImmutableMap
deep_immutable.dart:114
#14     toDeepImmutable
deep_immutable.dart:88
#15     new _SnapshotImpl
snapshot.dart:254
#16     _SnapshotImpl.set
snapshot.dart:362
#17     new UnmodifiableSnapshotView.fromJson
snapshot_view.dart:77
#18     new UserRecord.fromJson
user_record.dart:136
#19     AuthRequestHandler.downloadAccount.<anonymous closure>
auth_api_request.dart:93
#20     MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#21     ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#22     new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
#23     new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#24     new List.of (dart:core-patch/array_patch.dart:47:28)
#25     ListIterable.toList (dart:_internal/iterable.dart:214:7)
#26     AuthRequestHandler.downloadAccount
auth_api_request.dart:94
<asynchronous suspension>
#27     Auth.listUsers
auth.dart:56
<asynchronous suspension>
@livtanong
Copy link
Author

I think I've found the root cause, and it's an incomplete implementation of GoogleCloudIdentitytoolkitV1UserInfo.toJson. I have filed an issue in the library.

invertase/dart_firebase_apis#6

@livtanong
Copy link
Author

Turns out that this is by design. The workaround would be for firebase_admin to replace the .toJson() call with: jsonDecode(jsonEncode(u))
This is of course less efficient, but at least it will be "correct".

Context: dart_firebase_apis is based on googleapis.dart.
google/googleapis.dart#438

@timalenustmf
Copy link

running into this issue to in version 0.3.0-dev4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants