astubenbord / paperless-mobile

An (almost) fully fledged mobile paperless client.
GNU General Public License v3.0
604 stars 31 forks source link

[Bug]: Does not connect to my brand new Paperless-ngx #344

Open pypckompsite opened 5 months ago

pypckompsite commented 5 months ago

What happened?

The app does not connect to my paperless-ngx server on docker behind nginx proxy (Websockets enabled). The server in publicly accesable. The server URL is in form: https://paperless.DOMAIN.uk

When i click continue the app says "Nie udało się nawiązać połączenia z serwerem" (I got Polish locale, this translates to: Cant connect to the server).

The server works perfectly in a browser, on the affected phone and on PC. I have tried reinstalling the app both from play Store and from releases .apk file.

Steps to reproduce

  1. Install app
  2. Paste in server url
  3. Select PFX file
  4. Paste password
  5. Click 'Continue"
  6. App cant connect

Log output from the app

Pressing button does not generate logs

Screenshots

No response

Paperless-ng*x Version

2.2.1

Paperless-Mobile Version

3.1.8

Device

LG V60 EA

Operating System Version

Android 12

Device Locale

Poland

Selected Locale

None

Additional Context

No response

astubenbord commented 5 months ago

Hi, are you sure you are on paperless version 1.2.1? If this is the case (and you didn't mean 2.2.1), then I'll unfortunately have to tell you that this version is not supported anymore as it is just too old. Paperless has evolved quite a bit in the past months/years.

pypckompsite commented 5 months ago

Yep, its 2.2.1, sorry for the mistake

astubenbord commented 5 months ago

Did you set the PAPERLESS_URL Environment variable? Could you try to connect via IP (i.e. http://192.168...)?

plankobostjan commented 5 months ago

I'm experiencing the same issue as @pypckompsite after updating paperless-ngx to 2.3.0.

Trying to connect via IP does not solve the issue.

reneherbrich commented 5 months ago

I think these are different issues.

@plankobostjan: try clearing app data and setup paperless mobile again. The latest paperless-ngx version (2.3.0) now uses API v4, which seems to be unexpected for paperless mobile. After clearing data it falls back to v3 and you can login again.

[ AuthenticationCubit] - _getApiVersion : The server is running a newer API version (4) than the app supports (v3), falling back to latest supported version (v3). Warning: This might lead to unexpected behavior! 2024-01-07 12:17:46.273 DEBUG --- [ AuthenticationCubit] - _getApiVersion : Successfully retrieved API version (3).

@astubenbord: found two additional issues.

1) when trying to connect via Cloudflare and MTLS I'm not able to login anymore. With an older version it was already working. When I'm at home and connect directly to my paperless-ngx server it's working fine.

Scenario 1 (Login at home -> disable wifi -> login via Cloudflare) paperless_mobile_logs_2024-01-07.log

Scenario 2 (Clear data, Login via Cloudflare) Screenshot_20240107-122711

2) when trying to save the logs after issue 1) I'm getting tons of error messages and the log will not be saved. Screenshot_20240107-122739 Screenshot_20240107-122748

astubenbord commented 5 months ago

@reneherbrich Thanks for the comprehensive report. I'll check and see what's going on.

macrojames commented 5 months ago

Screenshot_20240107_172937.png

Same here, my server is on 2.3.0, fresh install from yesterday. Toast message error saying Api 4 not supported.

astubenbord commented 5 months ago

@macrojames This issue should be resolved in the latest version (v3.2.0).

macrojames commented 5 months ago

@macrojames This issue should be resolved in the latest version (v3.2.0).

Confirmed. Couldn't find anything like that in the change log.

Danke für deine App!

astubenbord commented 5 months ago

Yeah, it was under the "Some bug fixes" haha

Thanks, appreciate it :)

astubenbord commented 5 months ago

@reneherbrich There was indeed an issue with mTLS connections. Should hopefully be fixed in the next release.

pypckompsite commented 5 months ago

@reneherbrich There was indeed an issue with mTLS connections. Should hopefully be fixed in the next release.

Thanks, for the quick fix.

Great that v3.2.0 fixed the connection error. mTLS still broken, thanks for finding and fixing in next release.

reneherbrich commented 5 months ago

@astubenbord that was fast - thank you. Will let you know, as soon as the next release is available.

henningsieh commented 5 months ago

I had the same issue with App Version 3.1.8 connecting to the latest server version 2.3.2.

"API 4 not supported..."

App Version 3.2.0 fixed it! 🎉

reneherbrich commented 5 months ago

@astubenbord updated to 3.2.1 but issues mentioned earlier (mTLS and log writing loop) are still there. Logs look like the same as before.

paperless_mobile_logs_2024-01-19.log

astubenbord commented 5 months ago

Based on the log file it seems like there was a change in the API endpoint. I've noticed that the data type of the same property sometimes differs (e.g. the total file count reported from the statistics endpoint was reported as 0 if there were no documents yet and of object type including the file types if there was more than 1 document stored). These inconsistencies in the API specification can then lead to these errors which I do not catch since they are not expected. I'll have to try and reproduce this error to see when it occurs, and if what I mentioned is again the case I'll file a bug report to paperless-ngx.

reneherbrich commented 5 months ago

Made a mistake on my side, everything is working fine now - even with mTLS. Thanks!

veeroohre commented 3 months ago

I have a similar issue. I'm trying to login to my paperless-ngx instance via an URL, not IP address ("https:///paperless.[Subdomain].[Domain].de"). Get the error message "host cannot be resolved. Please check server address and internet connection" (translated from German).

Paperless-NGX is hosted on Docker in my LAN. I use Traefik as a reverse proxy. Connection via IP when connected to LAN is working. Via Browser, too. All version are up to date (Server 2.6.0, App 3.2.1). I'm connection via Google OAuth2. Normal login is disabled.

pdenessen commented 3 months ago

Similar issue here: When I login from my wifi network to the IP address of the docker server then it works, but when I use my FQDN (Vial a cloudflare tunnel, then it comes in a loop and have I to kill the application (Paperless 2.6.2) app: 3.2.1+405