Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextcloudFilesAppAccountNotFoundException after having server offline and migrating to Nextcloud app authentication #1190

Closed
rugk opened this issue May 1, 2021 · 7 comments

Comments

@rugk
Copy link

rugk commented May 1, 2021

Please use GitHub reactions 👍 to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

Is your feature request related to a problem? Please describe.

Yes, I do have the problem that I did upgrade this app to the latest version while not having an active Nextcloud account to use – because the server is “temporarily” down. In my case “temporarily” is a longer time… 😜

In any case, this is a problem, because now I have to choose an account, which cannot be contacted etc. and thus the app stops working. I now even cannot see previously used and saved notes now due to that.

Could not the same problem arise when you are in a forest with no network connectivity or just have flight mode enabled etc. etc.?
IMHO, the app should still be as usable as possible then.

To be more exact, currently it shows this:

App Version: 3.4.0
App Version Code: 3004000
App Flavor: fdroid

Files App Version Code: 30150190

---

OS Version: 4.9.218-perf+(04201636)
OS API Level: 29
Device: FP3
Manufacturer: Fairphone
Model (and Product): FP3 (FP3)

---

com.nextcloud.android.sso.exceptions.NextcloudFilesAppAccountNotFoundException: Konto in der Nextcloud App nicht gefunden
	at com.nextcloud.android.sso.AccountImporter.getSingleSignOnAccount(AccountImporter.java:192)
	at com.nextcloud.android.sso.helper.SingleAccountHelper.getCurrentSingleSignOnAccount(SingleAccountHelper.java:53)
	at it.niedermann.owncloud.notes.main.MainActivity.lambda$null$2$MainActivity(MainActivity.java:165)
	at it.niedermann.owncloud.notes.main.-$$Lambda$MainActivity$ZhWE-Elp2gTqL_Z3Kyw5s_28StU.run(Unknown Source:2)
	at java.lang.Thread.run(Thread.java:919)

Just in case you consider it a bug – though, I have to say it’s totally understandable it cannot find the account as the server is currently offline, as said. 😄

Describe the solution you'd like

Showing errors etc. may be okay – though once I’m logged in a warning is sufficient (that it cannot synchronize my notes), but IMHO, it should still keep my notes locally and allow me to use it as best as possible (just as with the files in a filesystem on a desktop). It should just sync the notes as fast as possible when the internet/server is back online.

Describe alternatives you've considered

Not really many…

Additional context

I saw #615 and it may be similar. However, my problem exists with an existing account and not about a about a separate “local notes could have account ID 0”, so I thought, this I’ll better open a new feature request as this may be something different…

@stefan-niedermann
Copy link
Member

The app is already fully offline capable and the error message hints on something else going wrong. The communication between the Notes Android app and the Nextcloud Android app failed, it did not even request the server.

However i am not able to reproduce the issue, but it looks like you maybe removed your acccount from the Nextcloud Android app after configuring it in the Notes Android app.

Can you please uninstall Notes (backup unsynchronized changes, they will be lost) to get rid of this weird state, upgrade to v3.4.1 and import your account again?
Then also check offline state and just reopen in case the issue persists 🙂

Thanks

@rugk rugk changed the title Allow offline mode when the account cannot be contacted NextcloudFilesAppAccountNotFoundException after having server offline Jun 15, 2021
@rugk
Copy link
Author

rugk commented Jun 15, 2021

Can you please uninstall Notes (backup unsynchronized changes, they will be lost) to get rid of this weird state

I cannot backup the changes, because it cannot synchronize them with Nextcloud, because of this error. So this is a chicken egg problem.
And I have some synchronized notes there that I would like to synchronize.

Indeed I have the server running again and it still does not work.

Also upgraded to the lastest version now and the error still happens – it tells me it knows my account though:

App Version: 3.4.9
App Version Code: 3004009
App Flavor: fdroid
Files App Version Code: 30160190
---
OS Version: 4.9.218-perf+(05131326)
OS API Level: 29
Device: FP3
Manufacturer: Fairphone
Model (and Product): FP3 (FP3)
---
java.lang.RuntimeException: Konto in der Nextcloud App nicht gefunden
	at it.niedermann.owncloud.notes.main.MainActivity.lambda$null$2$MainActivity(MainActivity.java:192)
	at it.niedermann.owncloud.notes.main.-$$Lambda$MainActivity$ZhWE-Elp2gTqL*Z3Kyw5s*28StU.run(Unknown Source:2)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.RuntimeException: Current SSO account: ***@*****:port/subdir
SSO SharedPreferences: 
PREF*CURRENT*ACCOUNT_STRING: ***@*****:port/subdir

PREF*ACCOUNT*STRING***@*****:port/subdir: rO0ABXNyAAtiLmIuYS5hLmc*******************************************************************
NXQAJWh0dHBzOi8vcHJ1Z2suZGVkeW4uaW86MTIzNC9uZXh0Y2xvdWR0AAluZXh0Y2xvdWQ=
    
Available accounts in DB: ***@*****:port/subdir
	... 7 more
Caused by: com.nextcloud.android.sso.exceptions.NextcloudFilesAppAccountNotFoundException: Konto in der Nextcloud App nicht gefunden
	at com.nextcloud.android.sso.AccountImporter.getSingleSignOnAccount(AccountImporter.java:192)
	at com.nextcloud.android.sso.helper.SingleAccountHelper.getCurrentSingleSignOnAccount(SingleAccountHelper.java:53)
	at it.niedermann.owncloud.notes.main.MainActivity.lambda$null$2$MainActivity(MainActivity.java:176)
	... 6 more

@rugk
Copy link
Author

rugk commented Jun 15, 2021

What might have caused this issue is that I upgraded to the new account system (with login via Nextcloud app) when that was available.

Before I used a custom access token IIRC, then the server got offline, then I upgraded by selecting my account from the Nextcloud app. But since then, I get this error and the app does not work.
I would have expected to be able to recover my local data at least - even if it does not sync.

Also, what's bad even more is that the app does not load the locally saved data, it just spins infinitively. I can also not click on the "account" switcher in the app to add a new account or so. I can do nothing,

Thus, could you please reopen this as a bug?

@rugk rugk changed the title NextcloudFilesAppAccountNotFoundException after having server offline NextcloudFilesAppAccountNotFoundException after having server offline and migrating to Nextcloud app authentication Jun 15, 2021
@stefan-niedermann
Copy link
Member

stefan-niedermann commented Jun 15, 2021

Thus, could you please reopen this as a bug?

No, we keep track of it in #1256 which describes the same issue.

Before I used a custom access token IIRC, then the server got offline, then I upgraded by selecting my account from the Nextcloud app. But since then, I get this error and the app does not work.

So according to your description you just upgraded from Version 1.x.x to version 3.4.x? Is this correct?

@rugk
Copy link
Author

rugk commented Jun 15, 2021

No, I did upgrade from time to time and used all versions. However, I did the migration (and AFAIK one could alsom not skip it), when it prompted me to do so. That is way older however.

@stefan-niedermann
Copy link
Member

now I have to choose an account

I did the migration (and AFAIK one could alsom not skip it), when it prompted me to do so.

I am not sure what you mean with "the migration"? The Notes app did never prompt for any migration. The only time in history you were prompted to choose an account was after an update from v1.0.x to v2.0.0 (or higher). Since you stated that you have used multiple versions since then, i need to more about those prompts and those migrations you are talking about. Have they been in the Notes app? Or maybe something in the Nextcloud app? What did they say? In the title, the buttons?

What exactly fid you do before the issue occurs the first time? You're NC instance was offline - so far so good, that is not an issue, the app can handle offline states. Did you do anything with your user account via the Web UI? Anything on your Android device in the Nextcloud app (the main app)? Or in the accounts section of the Android settings?
Was there an update of the main Nextcloud app?

@rugk
Copy link
Author

rugk commented Jun 19, 2021

The only time in history you were prompted to choose an account was after an update from v1.0.x to v2.0.0 (or higher)

This is what I’m referring to with “the migration”, i.e. the first time when the SSO was introduced.
Sorry for the confusion, I just of course did not remember the version numbers or kept track of them.

What exactly fid you do before the issue occurs the first time?

Based on your description, I guess I upgraded from v1.0.x to v2.0.0 (or higher). IIRC (but I’m really not sure about that), the first start worked, but then the next start it showed this error. But I could be wrong here.

You're NC instance was offline - so far so good, that is not an issue, the app can handle offline states.

Yeah, it could be totally unrelated to that…

Did you do anything with your user account via the Web UI?

No, the server was offline after all. 🙃

Anything on your Android device in the Nextcloud app (the main app)? Or in the accounts section of the Android settings?

No, it stayed all the way it was. The server has a different IP and I upgraded the server from NC 14 (I guess that was the last version it the News app had seen) to NC 21, but that’s it.

Was there an update of the main Nextcloud app?

Yes, I always updated the app, even though/even when the server was offline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants