Backendless Support
 
Assigned to Dev

Backendless 4: addRelation returns "BackendlessFault{ code: 'Internal client exception'[...]}"

No joy for the new Backendless 4 relation API on my home computer :(

Using the 2 examples below, I always receive the following error:BackendlessFault{ code: 'Internal client exception', message: 'http://192.168.178.31:80/api/[...]/binary' }

I am trying to add a relation of currently logged-in User with a "rsvp" column in Event table (one to many)

The data in the event and the backendlessUser objects is definitely ok, so there can't be a problem there.

I have run an example multiple times and always without exception received an ....exception (I could word that one better :) )

Example 1

Event event = events.get(eventIndex); // personObject retrieval is out of scope in this example

BackendlessUser backendlessUser = Global.gCurrentUser; // addressObject retrieval is out of scope in this example

ArrayList<BackendlessUser> backendlessUsers = new ArrayList<>();

backendlessUsers.add( backendlessUser );

Backendless.Data.of(Event.class).addRelation(event, "rsvp", "email=\"jure@j.j\"",

new AsyncCallback<Integer>() {

@Override

public void handleResponse(Integer response) {

Log.i( "MYAPP", "related objects have been added");

bRSVP = true;

}

@Override

public void handleFault(BackendlessFault fault) {

Log.e( "MYAPP", "server reported an error - " + fault.getMessage() );

bRSVP = false;

}

});

I have also tried to do it the other way.

Example 2:

Backendless.Data.of(Event.class).addRelation(event, "rsvp", backendlessUsers,

new AsyncCallback<Void>() {

@Override

public void handleResponse(Void response) {

Log.i( "MYAPP", "related objects have been added");

}

@Override

public void handleFault(BackendlessFault fault) {

Log.e( "MYAPP", "server reported an error - " + fault.getMessage() );

}

});

with the same BackendlessFault{ code: 'Internal client exception', message: 'http://192.168.178.31:80/api/[...]/binary' } risen.

The rest of the App is working nicely so I don't have any idea what the problem might be.

--------------------

Not related, but might be helpful to your company:

I noticed that the API has a different type(Void) then the documentation provided for Backendless 4 (Integer).

While they are both the same in the first example, the second example has mixed up types (Void for Integer).

The following is from documentation (compare with the above):

Backendless.Data.of( Person.class ).addRelation( personObject, "address", addressCollection, new AsyncCallback<Integer>() { @Override public void handleResponse( Integer response ) { Log.i( "MYAPP", "related objects have been added"); }

https://backendless.com/docs/android/doc.html#data_relations_api_set_add_android

I hope I have been of some help at least since I keep bothering you with these questions.

I must say I am enjoying the development with Backendless very much and you guys have provided me with most joy I have ever experienced in Java development! :D

So thank you and I hope you keep it up!

Leave a Comment

Comments (12)

photo
1

Hi Jure,

Thanks for your kind words about Backendless :)

Can we ask you to prepare a minimal code sample with with a data export so that we could import it to our app and reproduce the problem? Unfortunately, we haven't been able to reproduce it in an ordinary example.

photo
1

Thank you for the answer.

I wanted to create a minimal code sample before I asked the question, so I wouldn't bother you in vain, but changed my mind since Backendless is now on my computer and didn't know how it could benefit you this way.

I completely forgot about the data export! :D

I will do it today.

Where would I send it?

photo
1

Either attach it here or send to support@backendless.com. Thanks for your help!

photo
1

I am sending the minimized version to support's email now.

The only thing to do is add the KEY & APP_ID in the Constants Class, run the app and then click on any of the items in the list that shows up.

photo
1

Hi Jure,

In the code you're creating a relation which will be represented by column "rsvp". The relation will be between an "Event" object and all objects matching the where clause "email=\"jure@j.j"

The question is: what other table should "rsvp" point to? This is the table where the where clause will run. That information is not provided. Should it be "Users", "Event" or "Body" ?

Regards,

Mark

photo
1

It should point to Users table. But I don't know what am I missing. Isn't it enough that there exists a relationship in database between RSVP column in Event table and the Users table?

Where should I provide this information?

Can you help please?

photo
1

This works though!!!!

  1. HashMap<String, Object> parentObject = new HashMap<String, Object>();
  2. parentObject.put( "objectId", event.getObjectId() );
  3. Backendless.Data.of( "Event" ).addRelation( parentObject,
  4. "rsvp",
  5. "email='jure@j.j'",
  6. new AsyncCallback<Integer>()
  7. {
  8. @Override
  9. public void handleResponse( Integer response )
  10. {
  11. Log.i( "MYAPP", "related objects have been added" );
  12. }
  13. @Override
  14. public void handleFault( BackendlessFault fault )
  15. {
  16. Log.e( "MYAPP", "server reported an error - " + fault.getMessage() );
  17. }
  18. } );

photo
1

but this doesn't using the very same Event object

  1. Backendless.Data.of(Event.class).addRelation(event, "rsvp", "email='jure@j.j'",
  2. new AsyncCallback<Integer>() {
  3. @Override
  4. public void handleResponse(Integer response) {
  5. Log.i( "MYAPP", "related objects have been added");
  6. }
  7. @Override
  8. public void handleFault(BackendlessFault fault) {
  9. Log.e( "MYAPP", "server reported an error - " + fault.getMessage() );
  10. }
  11. });

photo
1

Anyway... It looks that I can use Maps to solve this problem!

The Map version works perfectly!!!!

photo
1

Thank you for checking both approaches. We will investigate why the class-based approach is failing.

Just to confirm: you have the "rsvp" column defined in the Event table. The column points to Users and is declared as one-to-many, is that correct?

Regards,

Mark

photo
1

Yes.

I have also sent the minimized version to support's email yesterday if it helps. Complete with exported tables

b1578ac22ee17b16160aaf5a62367dc0

photo
1

I think this has the wrong flag "Waiting for user's response"

photo