farmOS / field-kit

A modular, offline-first companion app to farmOS.
https://farmOS.org
GNU General Public License v3.0
60 stars 39 forks source link

Can't upload logs with Android Fieldkit App #372

Closed and712 closed 4 years ago

and712 commented 4 years ago

Hi :)

as noted yesterday in the forum i can't upload any logs with the Fieldkit App. The PWA App (farmos.app) works as normal.

Steps to reproduce:

  1. Login into the App (successful)
  2. (create an log)
  3. press the upload button
  4. Login screen appears again. No error message.

Used Software and Hardware:

Tried Steps to solve the issue:

Is there a possibility to access any logs on the Android Device?

and712 commented 4 years ago

i noticed there is also a From Thread with the same problem: https://farmos.discourse.group/t/field-kit-syntax-error-unexpected-token-o-in-json-at-position-0/432/13

jgaehring commented 4 years ago

Just to confirm, which version of the Android app are you using?

What data are you including in the log? Any images or files?

Does your server have clean url's enabled?

Ah yes, I thought of that forum thread too, but it should be resolved so long as you're using FK version 0.5.1. EDIT: See next comment.

jgaehring commented 4 years ago

Ah yes, I thought of that forum thread too, but it should be resolved so long as you're using FK version 0.5.1.

Scratch that, I forgot that's a server-side fix that only went out to Farmier sites, and is awaiting release with farmOS 1.5. Hang on, I'll find the update you need to pull in a second...

jgaehring commented 4 years ago

Ok, I believe the commit you need is farmOS/farmOS@8a58fa73, but if you pull the main 7.x-1.x branch from the drupal.org repo, you should be set.

Let me know if you need help doing that.

and712 commented 4 years ago

The newest Version thats avaible at the Play Store , thats 0.5.1

Ok, I believe the commit you need is farmOS/farmOS@8a58fa7, but if you pull the main 7.x-1.x branch from the drupal.org repo, you should be set.

Let me know if you need help doing that.

Both farmOS instances are running the newest stable version from Drupal.org Maybe the dev version would help? https://www.drupal.org/project/farm/releases/7.x-1.x-dev

What i also dont understand is: Why is the PWA working as usual if this is an server error?

and712 commented 4 years ago

i can confirm that the Android App is working with the Farmier Hosting.

jgaehring commented 4 years ago

Sorry, still troubleshooting... I actually don't think that was the commit you needed. I think there's a patch we pushed to Farmier but neglected to push to drupal.org.

What i also dont understand is: Why is the PWA working as usual if this is an server error?

The issue is with an unused cookie being pushed to the server. In the PWA the browser doesn't send that cookie because it's cross-site, but the Android app is not a website so it's still sending the cookie. There's a bug in the restws module we use where if that cookie is sent, even if we're not using it, it rejects any POST or PUT requests. Getting the instructions right now from @mstenta for how to apply the patch yourself.

jgaehring commented 4 years ago

@and712, you should be able to run this on your non-Farmier server to get the patch:

cd profiles/farm/modules/contrib/restws
wget https://www.drupal.org/files/issues/2020-07-28/3161965-2.patch
patch -p1 < 3161965-2.patch

Just double check that you've cd'ed into the correct directory first. You may need to append that with www/.

And let me know if that works.

and712 commented 4 years ago

Thank you! The fix worked! This issue also contributes to my opinion posted in the forum about the Android, iOS and PWA version.

mstenta commented 4 years ago

Great! Glad we figured it out! And thanks for the reminder that we needed to commit that patch to farmOS. Almost slipped between the cracks. :-)

jgaehring commented 4 years ago

Great! Glad that did it! I'm going to create a forum post to address this patch, too. We were rushing to get a bunch of fixes out and did not document it properly from the start.

This issue also contributes to my opinion posted in the forum about the Android, iOS and PWA version.

Haha, meee tooo. :wink:

and712 commented 4 years ago

Great! Glad we figured it out! And thanks for the reminder that we needed to commit that patch to farmOS. Almost slipped between the cracks. :-)

Great! Glad that did it! I'm going to create a forum post to address this patch, too. We were rushing to get a bunch of fixes out and did not document it properly from the start.

Also the entire updating process of farmOS is not really clear to me, but i also will make a forum post about it.

jgaehring commented 4 years ago

Thanks, @and712, this feedback is all tremendously helpful!

Closing this.