Support Topics Documentation Slack YouTube Blog

ownerId not being passed to custom function

isValidLogin returns true and yet when I call my custom service, the userId attribute is null. Am I missing something here? Do I have to pass it in myself? I was under the impression that Backendless handles all that.

Hello, @jp19344. Thank you for contacting us. For a complete understanding of the problem, could you please describe in more detail what you are trying to do?
Answer a few questions:

  1. Which one SDK do you use: Android, Flutter or something else?
  2. What exactly are you trying to do? (Describe the steps to reproduce the error, code blocks, screenshots, and a detailed description)
  3. Write the AppID of your application.

This will greatly speed up the time it takes to solve your problem.

Best regards, Niktia.

@Nikita_Fedorishchev

  1. I’m using the flutter SDK
  2. I first log in using user, and call this temporary test function that does this.

Blockquote
BackendlessUser currentUser = await Backendless.userService.currentUser();
bool isValidLogin = await Backendless.userService.isValidLogin();
print(currentUser);
print(isValidLogin);
Backendless.customService.invoke(
‘Listing’,
‘createListing’,
{
‘title’: ‘This is a title’,
‘description’: ‘This is a description’,
‘category’: ‘Electronics’,
‘condition’: ‘New’,
‘price’: 500,
‘allowOffers’: false,
‘coordinates’: {“type”: “Point”,
“coordinates”: [
-111.97574051,
33.62711394
]
},
‘images’: [{‘test.txt’: ‘A text file’}],
},
);

images is an array of images with filenames as the key and the content being the image in base64. Though no checks are done on the custom service, you can just use a regular text file for testing purpose as that will also go through.

Results of this are

Blockquote
BackendlessUser{{lastName: REMOVED, lastLogin: 2021-05-06 10:36:35.381, userStatus: ENABLED, gender: Male, created: 2021-02-25 16:25:31.000, profilePic: https://backendlessappcontent.com/91C381E4-3673-9CE4-FF2E-6E8B25311500/039E0D16-5759-48B6-ABD1-1B2F46BE5634/files/defaults/profile_pic.jpg, accountType: BACKENDLESS, numReviews: 12, verified: false, rating: 4.5, ownerId: 43469402-DDA0-4DF7-8EB8-E9305F6696FB, socialAccount: BACKENDLESS, oAuthIdentities: null, firstName: REMOVED, ___class: Users, blUserLocale: en, updated: 2021-05-02 20:12:00.000, email: REMOVED, objectId: 43469402-DDA0-4DF7-8EB8-E9305F6696FB, username: REMOVED}}
I/flutter (17996): true
E/flutter (17996): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: BackendlessException: Field ‘ownerId’ doesn’t have a default value, code = 1364
E/flutter (17996): #0 Invoker.invoke. (package:backendless_sdk/src/modules/common/invoker.dart:20:11)
E/flutter (17996): #1 _rootRunUnary (dart:async/zone.dart:1362:47)
E/flutter (17996): #2 _CustomZone.runUnary (dart:async/zone.dart:1265:19)
E/flutter (17996): #3 _FutureListener.handleValue (dart:async/future_impl.dart:152:18)
E/flutter (17996): #4 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:704:45)
E/flutter (17996): #5 Future._propagateToListeners (dart:async/future_impl.dart:733:32)
E/flutter (17996): #6 Future._completeWithValue (dart:async/future_impl.dart:539:5)
E/flutter (17996): #7 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:254:13)
E/flutter (17996): #8 _withClient (package:http/http.dart)
E/flutter (17996):
E/flutter (17996):

App Id is 91C381E4-3673-9CE4-FF2E-6E8B25311500

Hello @jp19344

Thank you for the report!
It seems like a bug in the Flutter SDK, I just created an internal ticket BKNDLSS-25035 to investigate this problem.

Regards, Vlad