objectbox-java icon indicating copy to clipboard operation
objectbox-java copied to clipboard

Download All in Objectbox Admin fails

Open Schmalztopf opened this issue 3 years ago • 1 comments
trafficstars

Hello,

from version 3.1.0 and above it is not possible to download the tables in ObjectBox Admin anymore. It just responses 401 - Session ID not present.

When I downgrade Objectbox to 3.0.1, download is possible.

Steps to Reproduce:

  • Create Android App project
  • In app.java:
@Override
   public void onCreate() {
 [...]
      if (BuildConfig.DEBUG_MODE) {
/*          Admin objectBoxAdmin = new Admin(getObjectBoxIO().getBoxStore(this.getBaseContext()));
          objectBoxAdmin.start(this);
          objectBoxAdmin.setNotificationId(1);*/
          AndroidObjectBrowser objectBrowser = new AndroidObjectBrowser(getObjectBoxIO().getBoxStore(this.getBaseContext()));
          objectBrowser.setNotificationId(1);
          objectBrowser.start(this.getBaseContext());

          /*Admin archieveBoxAdmin = new Admin(getArchiveBoxIO().getBoxStore(this.getBaseContext()));
          archieveBoxAdmin.setNotificationId(2);
          archieveBoxAdmin.start(this);*/
          AndroidObjectBrowser archiveBrowser = new AndroidObjectBrowser(getArchiveBoxIO().getBoxStore(this.getBaseContext()));
          archiveBrowser.setNotificationId(2);
          archiveBrowser.start(this.getBaseContext());
      }
 [...]
}
  • start application on emulator
  • In Terminal:
adb forward tcp:8090 tcp:8090
adb forward tcp:8091 tcp:8091
  • Open Objectbox Admin in browser on dev machine and click on download all.

I tried both the deprecated syntax via AndroidObjectBrowser and the new one calling new Admin(...). The result is the same in both ways.

Note, that my app addresses two databases in which I store in different locations by setting the file path via

MyObjectBox.builder()
                .name("dbxyz")
                .androidContext(context.getApplicationContext())
                .build();

in the wrapper classes ObjectBoxIO and ArchiveBoxIO.

Best regards Thomas

Schmalztopf avatar Aug 23 '22 07:08 Schmalztopf

Thanks for reporting! I can confirm. But actually this does not work as of version 3.1.1, version 3.1.0 is not affected.

This is likely related to the change away from cookies towards an authorization header for authorization. We'll update this once we know when a fix is available.

greenrobot-team avatar Aug 23 '22 09:08 greenrobot-team

any update on this?

leononly avatar Jan 13 '23 03:01 leononly

@leononly Sorry, not yet. Note that a workaround is to write code that writes your objects as JSON (e.g. using Gson).

Out of interest, what would you be using that functionality for?

greenrobot-team avatar Jan 16 '23 08:01 greenrobot-team

Fixed internally; will be part of the next release.

greenrobot avatar Mar 21 '23 15:03 greenrobot

This was fixed with the 3.6.0 release.

greenrobot-team avatar Jul 10 '23 07:07 greenrobot-team