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

SQLiteConstraintException: UNIQUE constraint failed #1447

Open
1 of 4 tasks
duckimann opened this issue Mar 12, 2023 · 114 comments
Open
1 of 4 tasks

SQLiteConstraintException: UNIQUE constraint failed #1447

duckimann opened this issue Mar 12, 2023 · 114 comments
Labels
🐞 bug Something isn't working

Comments

@duckimann
Copy link

Steps to reproduce the behavior:

  1. Click Choose Account
  2. Choose suitable account
  3. Accept Nextcloud Deck access Nextcloud Account
  4. Wait to import boards
  5. Error shows up

Expected behavior
Import available boards

Screenshots
Screenshot_2023-03-13-06-53-31-907_it niedermann nextcloud deck
Screenshot_2023-03-13-06-52-52-344_it niedermann nextcloud deck

Versions

  • Nextcloud: 25.0.4
  • Nextcloud Deck: 1.8.3
  • Nextcloud Android: 3.24.1
  • Nextcloud Android Deck: 1.21.8

Smartphone (please complete the following information):

  • Device: Xiaomi Redmi Note 11
  • Android-Version: 12
  • App-Store:
    • Google Play Store
    • Google Play Store (Beta channel)
    • F-Droid
    • Huawei AppGallery

Stacktrace

App Version: 1.21.8
App Version Code: 1021008
Server App Version: 1.8.3
App Flavor: fdroid

Files App Version Code: 30240190

---

OS Version: 4.19.157-perf-g85e27949fb09(V13.0.7.0.SGCMIXM)
OS API Level: 31
Device: spes
Manufacturer: Xiaomi
Model (and Product): 2201117TG (spes_global)

---

android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: Card.accountId, Card.id (code 2067 SQLITE_CONSTRAINT_UNIQUE)
	at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
	at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:940)
	at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
	at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:89)
	at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.kt:42)
	at androidx.room.EntityInsertionAdapter.insertAndReturnId(EntityInsertionAdapter.kt:102)
	at it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao.CardDao_Impl.insert(CardDao_Impl.java:263)
	at it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao.CardDao_Impl.insert(CardDao_Impl.java:43)
	at it.niedermann.nextcloud.deck.persistence.sync.adapters.db.DataBaseAdapter.createCardDirectly(DataBaseAdapter.java:709)
	at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider.createInDB(CardDataProvider.java:84)
	at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider.createInDB(CardDataProvider.java:34)
	at it.niedermann.nextcloud.deck.persistence.sync.helpers.SyncHelper$1.onResponse(SyncHelper.java:62)
	at it.niedermann.nextcloud.deck.persistence.sync.helpers.SyncHelper$1.onResponse(SyncHelper.java:47)
	at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider$1.onResponse(CardDataProvider.java:63)
	at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider$1.onResponse(CardDataProvider.java:58)
	at it.niedermann.nextcloud.deck.api.RequestHelper$ResponseConsumer.accept(RequestHelper.java:52)
	at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
	at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:62)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher$PublisherSubscriber.onNext(ObservableFromPublisher.java:56)
	at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$1$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:130)
	at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda0.subscribe(Unknown Source:6)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
	at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
	at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
	at java.lang.Thread.run(Thread.java:1012)

@Gobytego
Copy link

Gobytego commented Apr 7, 2023

i get this exact issue... even tried multiple versions including the play store and f-droid versions.
also tried multiple phones/tablets

@stefan-niedermann
Copy link
Owner

Versions prior to 1.22.x had a known issue in parallel execution that could lead to this error.

Please wait until 1.22.x is available on your store, then clear the storage of the deck android app as described in our FAQ and import your account again.

@Gobytego
Copy link

Gobytego commented Apr 7, 2023

Cannot pinpoint it to just one board.
Here is what I did.
Made a test user.
Kept him out of any groups that are shared with the boards.
Shared one board.
Worked.
Shared each board without clearing data on the app.
Worked.
Left all boards shared to that user.
Cleared the app data.
Tried the initial sync.
Failed.
Tried just one board at a time clearing the app and share on the boards to make sure he is only getting the one board.
Worked on all boards.
So I can't pinpoint it to one board and I can sort of get it working if I do the first board sync then add one board at a time to that user and refresh sync.

One suggestion if possible is have the user be able to select only the boards they want synced on mobile.
It is a suggestion a few of my users want and it might be a quick bandaid for this issue right now.

@Gobytego
Copy link

Gobytego commented Apr 7, 2023

Oh I forgot to say this is all on 1.22.1

@Gobytego
Copy link

Gobytego commented Apr 7, 2023

App Version: 1.22.1
App Version Code: 1022001
Server App Version: 1.8.3
App Flavor: play

Files App Version Code: 30240290

---

OS Version: 4.14.186-gd5b54dace-dirty(root.20220812.180105)
OS API Level: 30
Device: Titan_Slim
Manufacturer: Unihertz
Model (and Product): Titan Slim (Titan_Slim)

---

android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)
	at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
	at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:938)
	at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
	at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88)
	at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.kt:42)
	at androidx.room.EntityInsertionAdapter.insertAndReturnId(EntityInsertionAdapter.kt:102)
	at it.niedermann.nextcloud.deck.database.dao.MentionDao_Impl.insert(MentionDao_Impl.java:142)
	at it.niedermann.nextcloud.deck.database.dao.MentionDao_Impl.insert(MentionDao_Impl.java:23)
	at it.niedermann.nextcloud.deck.database.DataBaseAdapter.createMention(DataBaseAdapter.java:1179)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.DeckCommentsDataProvider.persistMentions(DeckCommentsDataProvider.java:90)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.DeckCommentsDataProvider.createInDB(DeckCommentsDataProvider.java:82)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.DeckCommentsDataProvider.createInDB(DeckCommentsDataProvider.java:21)
	at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:62)
	at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:47)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.DeckCommentsDataProvider$1.onResponse(DeckCommentsDataProvider.java:41)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.DeckCommentsDataProvider$1.onResponse(DeckCommentsDataProvider.java:32)
	at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.accept(RequestHelper.java:52)
	at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
	at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:62)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher$PublisherSubscriber.onNext(ObservableFromPublisher.java:56)
	at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$1$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:130)
	at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda0.subscribe(Unknown Source:6)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
	at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
	at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
	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:923)

@Gobytego

This comment was marked as resolved.

@Gobytego

This comment was marked as resolved.

@stefan-niedermann
Copy link
Owner

Thanks for the information!

  • The issue is caused by wrong handling of comments
  • The server log is irrelevant, the problem is purely client side as far as I can see
  • Synchronizing only parts of an account is currently not on our roadmap

@desperateCoder should be able to track down the root cause 😉

@stefan-niedermann stefan-niedermann added the 🐞 bug Something isn't working label Apr 7, 2023
@desperateCoder
Copy link
Collaborator

I'll look into it these days, but this weekend is quite packed already. I'll keep you guys updated!

@Gobytego
Copy link

Gobytego commented Apr 7, 2023

Thank you so much. If I find anything I'll post it.

@desperateCoder
Copy link
Collaborator

@Gobytego can you please test the following Build and report back if this one works reliably for you:

APK ¯(°_o)/¯

This is a debug build, which will be installed besides your regular Deck app, but it has a "DEV" label on its icon. Nothing will happen to your actual App.

This build has a ton of changes regarding the sync, so it might just work or just die... Depending on the amount of data on your server the sync may take a while, but it should be more stable from what i can tell.

@Gobytego
Copy link

Gobytego commented Apr 8, 2023

I get this.

App Version: 1.22.1
App Version Code: 1022001
Server App Version: 1.8.3
App Flavor: dev

Files App Version Code: 30240290

---

OS Version: 4.14.186-gd5b54dace-dirty(root.20220812.180105)
OS API Level: 30
Device: Titan_Slim
Manufacturer: Unihertz
Model (and Product): Titan Slim (Titan_Slim)

---

com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: HTTP request failed with HTTP status-code: 500
	at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.lambda$onResponse$0$it-niedermann-nextcloud-deck-remote-api-RequestHelper$ResponseConsumer(RequestHelper.java:50)
	at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer$$ExternalSyntheticLambda0.run(Unknown Source:6)
	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:923)
Caused by: java.lang.RuntimeException: HTTP StatusCode wasn't 2xx
	... 7 more

@desperateCoder
Copy link
Collaborator

Did it at least survive longer?

Anyways, the cut-off logs are quite crappy, I'll see if I can make it more verbose. I'll check on this and report back as soon as I have a fix.

@Gobytego
Copy link

Gobytego commented Apr 8, 2023

It seems to be the same. I'll try again.

@Gobytego
Copy link

Gobytego commented Apr 8, 2023

Yah same thing.

@desperateCoder
Copy link
Collaborator

Ok, so I enhanced the error messages for failed calls like in your case - I should now see where it fails for the client side (you already provided server logs, thanks for that! I still need to make sure this is the issue on our side as well.)

so the following APK should be more verbose regarding the failed request:

APK (ノ ゜Д゜)ノ ︵ ┻━┻

Please uninstall the DEV app if you didn't do so already and install the APK above. It most probably will die at the exact same moment as before, but will hopefully provide a ton of more context to work with.

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Now its hanging with no errors. I tried wiping data from all three apps and started again but still just hanging but on a different board.

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Wait I got something.

App Version: 1.22.1
App Version Code: 1022001
Server App Version: 1.8.3
App Flavor: play

Files App Version Code: 30240290

---

OS Version: 4.14.186-gd5b54dace-dirty(root.20220812.180105)
OS API Level: 30
Device: Titan_Slim
Manufacturer: Unihertz
Model (and Product): Titan Slim (Titan_Slim)

---

android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)
	at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
	at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:938)
	at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
	at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88)
	at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.kt:42)
	at androidx.room.EntityInsertionAdapter.insertAndReturnId(EntityInsertionAdapter.kt:102)
	at it.niedermann.nextcloud.deck.database.dao.StackDao_Impl.insert(StackDao_Impl.java:177)
	at it.niedermann.nextcloud.deck.database.dao.StackDao_Impl.insert(StackDao_Impl.java:33)
	at it.niedermann.nextcloud.deck.database.DataBaseAdapter.createStack(DataBaseAdapter.java:681)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.StackDataProvider.createInDB(StackDataProvider.java:44)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.StackDataProvider.createInDB(StackDataProvider.java:20)
	at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:62)
	at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:47)
	at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.accept(RequestHelper.java:52)
	at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
	at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:62)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher$PublisherSubscriber.onNext(ObservableFromPublisher.java:56)
	at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$1$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:130)
	at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda0.subscribe(Unknown Source:6)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
	at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
	at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
	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:923)

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

App Version: 1.22.1
App Version Code: 1022001
Server App Version: 1.8.3
App Flavor: play

Files App Version Code: 30240290

---

OS Version: 4.14.186-gd5b54dace-dirty(root.20220812.180105)
OS API Level: 30
Device: Titan_Slim
Manufacturer: Unihertz
Model (and Product): Titan Slim (Titan_Slim)

---

android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)
	at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
	at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:938)
	at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
	at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88)
	at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.kt:42)
	at androidx.room.EntityInsertionAdapter.insertAndReturnId(EntityInsertionAdapter.kt:102)
	at it.niedermann.nextcloud.deck.database.dao.UserDao_Impl.insert(UserDao_Impl.java:177)
	at it.niedermann.nextcloud.deck.database.dao.UserDao_Impl.insert(UserDao_Impl.java:29)
	at it.niedermann.nextcloud.deck.database.DataBaseAdapter.createUser(DataBaseAdapter.java:393)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.CardDataProvider.fixRelations(CardDataProvider.java:100)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.CardDataProvider.createInDB(CardDataProvider.java:83)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.CardDataProvider.createInDB(CardDataProvider.java:34)
	at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:62)
	at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:47)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.CardDataProvider$1.onResponse(CardDataProvider.java:63)
	at it.niedermann.nextcloud.deck.remote.helpers.providers.CardDataProvider$1.onResponse(CardDataProvider.java:58)
	at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.accept(RequestHelper.java:52)
	at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
	at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:62)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher$PublisherSubscriber.onNext(ObservableFromPublisher.java:56)
	at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$1$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:130)
	at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda0.subscribe(Unknown Source:6)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
	at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
	at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
	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:923)

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Screenshot_20230409-123217

@desperateCoder
Copy link
Collaborator

desperateCoder commented Apr 9, 2023

I'm slightly confused:

App Flavor: play

This is your actual app, not the one I posted above, right? The dev build should be like App Flavor: dev or am I missing something?

Edit:

In case something won't work (e.g. no error at all, but no sync either) please try to delete app data before uninstalling. Android behaves quite randomly when it comes to uninstalling apps ..

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Oh maybe I accedently hit the regular app. Hold I'll do it again.

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Screenshot_20230409-142922

So tried it again and it just hangs here with no traffic or anything.

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Ok so I uninstalled both the nextcloud app. And the deck app plus the deck Dev you sent. Just reinstalled both the nextcloud app and the deck Dev. Its now just sitting there looks like its stuck on importing either board 5,8,9, or 11 but no error. Where as before with the non Dev version it wouldn't get past board 4 with out giving me a bunch of the error.

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Okay this time it got stuck on 6. Very inconsistent. But still no error.

@desperateCoder
Copy link
Collaborator

how long did you let it do its thing? as mentioned, the time it runs highly depends of a boards data. Can you just let it do whatever it does for a longer period of time? I have a quite big test-account with like hundreds of cards and it took like 20 minutes to finally finish... if you have a log viewer (e.g. logcat) installed, you could check out if the app is still logging stuff, i bet it does. I didn't experience a single case of "it just stopped doing stuff", it either dies or just takes its time.

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Okay I'll keep it going.

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Here are two screen shots. One from a little after I started and one from now. It seems to just be sitting there but I'll keep it going.
Screenshot_20230409-145829

@Gobytego
Copy link

Gobytego commented Apr 9, 2023

Screenshot_20230409-153810

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

holy crap.. cleared the app data one more time... let it try to sync again and this time it seemed to work... some missing cards but no errors... going to play and see what else its missing...

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

ok going to try on my production server...

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

yeah no still getting errors.... but here is the server's log...

OCA\Deck\BadRequestException: userId must be provided and must be not empty

/var/snap/nextcloud/39212/nextcloud/extra-apps/deck/lib/Validators/BaseValidator.php - line 85:

OCA\Deck\Validators\BaseValidator->validate()

/var/snap/nextcloud/39212/nextcloud/extra-apps/deck/lib/Service/AssignmentService.php - line 108:

OCA\Deck\Validators\BaseValidator->check()

<>

OCA\Deck\Service\AssignmentService->__construct()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php - line 116:

ReflectionClass->newInstanceArgs()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php - line 124:

OC\AppFramework\Utility\SimpleContainer->buildClass()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php - line 142:

OC\AppFramework\Utility\SimpleContainer->resolve()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 494:

OC\AppFramework\Utility\SimpleContainer->query()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 466:

OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php - line 97:

OC\AppFramework\DependencyInjection\DIContainer->query()

<>

OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}("*** sensiti ... *")

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php - line 116:

array_map()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php - line 124:

OC\AppFramework\Utility\SimpleContainer->buildClass()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php - line 142:

OC\AppFramework\Utility\SimpleContainer->resolve()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 494:

OC\AppFramework\Utility\SimpleContainer->query()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 466:

OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()

/snap/nextcloud/39212/htdocs/lib/private/AppFramework/App.php - line 162:

OC\AppFramework\DependencyInjection\DIContainer->query()

/snap/nextcloud/39212/htdocs/lib/private/Route/Router.php - line 315:

OC\AppFramework\App::main()

/snap/nextcloud/39212/htdocs/lib/base.php - line 1068:

OC\Route\Router->match()

/snap/nextcloud/39212/htdocs/index.php - line 36:

OC::handleRequest()

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

Tried with a new user with no boards associated. Worked fine. Added one board and got this...

Screenshot_20240103-112945_Nextcloud Deck

Full Crash:

App Version: 1.23.4
App Version Code: 1023004
App Flavor: dev

Files App Version Code: 30260090 (PROD)

---

OS Version: 4.14.328-g9a1906b02e67(df647df382)
OS API Level: 33
Device: coral
Manufacturer: Google
Model (and Product): Pixel 4 XL (coral)

---

java.lang.NullPointerException: Attempt to read from field 'androidx.swiperefreshlayout.widget.SwipeRefreshLayout it.niedermann.nextcloud.deck.databinding.ActivityMainBinding.swipeRefreshLayout' on a null object reference in method 'void it.niedermann.nextcloud.deck.ui.main.MainActivity$3.lambda$onError$1$it-niedermann-nextcloud-deck-ui-main-MainActivity$3()'
	at it.niedermann.nextcloud.deck.ui.main.MainActivity$3.lambda$onError$1$it-niedermann-nextcloud-deck-ui-main-MainActivity$3(MainActivity.java:371)
	at it.niedermann.nextcloud.deck.ui.main.MainActivity$3$$ExternalSyntheticLambda0.run(Unknown Source:2)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7924)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

then same user the board shows up and if i refresh it works but will only show new cards... all old cards are not showing

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

ok with the new user if i set only one board at a time after they're signed in it will sync then the deck is useable but can only set one board at a time... also kind of sucks cause i would have to take that user ou of the group to get then to only be on one board at a time. once all the boards are synced up then i can add then to the group again then go into one board at a time and remove their name... kind of a pain in the ass but its a crude work around for now... really sucks when you have over 50 users and multiple groups especially when some users are in multiple groups and some of those groups only see one or two boards etc... yeah big pain in the ass.

@desperateCoder
Copy link
Collaborator

The last one seems to be UI-related (@stefan-niedermann).

Holy cow! Is your setup kind of special or something? I don't have ever seen anything like these errors yet, only the ConstraintViolation thingy...

OCA\Deck\BadRequestException: userId must be provided and must be not empty

Regarding this one: Please tell me this didn't happen while syncing... The sync-process itself doesn't assign anything. At least it shouldn't and I'm quite sure it doesn't. Maybe someone else caused the error? Or was it you playing around with a half-broken dataset?

Regarding connection refused: I don't think this is an error on our side. Maybe bad internet connection? Server-setup?

also kind of sucks

Totally agree! Thats not the goal and I'm doing my best to fix this. But its really hard to code in this highly fragmented environment while dealing with multithreaded hierarchical sync mechanisms. I'll see what i can do.

Please see if the following behaves any different: (ಥ﹏ಥ) APK

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

ok will try now....

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

App Version: 1.23.4
App Version Code: 1023004
Server App Version: 1.11.2
App Flavor: dev

Files App Version Code: 30260090 (PROD)

---

OS Version: 4.14.328-g9a1906b02e67(df647df382)
OS API Level: 33
Device: coral
Manufacturer: Google
Model (and Product): Pixel 4 XL (coral)

---

com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: HTTP request failed with HTTP status-code: 500
	at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.onResponse(RequestHelper.java:51)
	at com.nextcloud.android.sso.helper.Retrofit2Helper$1.lambda$enqueue$0$com-nextcloud-android-sso-helper-Retrofit2Helper$1(Retrofit2Helper.java:86)
	at com.nextcloud.android.sso.helper.Retrofit2Helper$1$$ExternalSyntheticLambda0.run(Unknown Source:6)
	at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.RuntimeException: HTTP StatusCode wasn't 2xx:
Got [HTTP 500] for Call [GET http://localhost//index.php/apps/deck/api/v1.1/boards/8/stacks/32/cards/1737] with Message:
[<!DOCTYPE html>
<html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="en_US" translate="no" >
	<head
 data-requesttoken="">
		<meta charset="utf-8">
		<title>
			Generico Cloud		</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
				<meta name="apple-itunes-app" content="app-id=1125420102">
				<meta name="theme-color" content="#292929">
		<link rel="icon" href="/core/img/favicon.ico">
		<link rel="apple-touch-icon" href="/core/img/favicon-touch.png">
		<link rel="mask-icon" sizes="any" href="/core/img/favicon-mask.svg" color="#292929">
		<link rel="manifest" href="/core/img/manifest.json">
		<link rel="stylesheet" href="/core/css/server.css?v=0c61337a-9">
<link rel="stylesheet" href="/extra-apps/extract/css/style.css?v=7178aad2-9">
<link rel="stylesheet" href="/extra-apps/side_menu/css/sideMenu.css?v=d688dae7-9">
<link rel="stylesheet" href="/core/css/styles.css?v=0c61337a-9">
<link rel="stylesheet" href="/core/css/header.css?v=0c61337a-9">
<link rel="stylesheet" href="/apps/theming/css/default.css?v=34e90de1-9">
<link rel="stylesheet" href="/core/css/guest.css?v=0c61337a-9">
		<script nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" defer src="/dist/core-common.js?v=0c61337a-9"></script>
<script nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" defer src="/dist/core-main.js?v=0c61337a-9"></script>
<script nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" defer src="/dist/core-files_fileinfo.js?v=0c61337a-9"></script>
<script nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" defer src="/dist/core-files_client.js?v=0c61337a-9"></script>
<script nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" defer src="/index.php/js/core/merged-template-prepend.js?v=0c61337a-9"></script>
<script nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" defer src="/apps/encryption/js/encryption.js?v=0c61337a-9"></script>
<script nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" defer src="/dist/files_sharing-main.js?v=0c61337a-9"></script>
<script nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" defer src="/extra-apps/extract/js/extraction.js?v=0c61337a-9"></script>
<script nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" defer src="/extra-apps/side_menu/js/sideMenu.js?v=0c61337a-9"></script>
		<link rel="stylesheet" href="/index.php/apps/side_menu/css/stylesheet?v=1"></link><script defer nonce="TzBGWHV6UlFEa2sxdGFsTTBkeENEaTAzVVVpQnMzS1NOc0g5QjZvL3lPbz06YVhJUitub0RYQ3hYL3ZrOWlMUnhhbjlSSGh2VHhTRFVVWXlsVU45R3BOaz0=" src="/index.php/apps/side_menu/js/script?v=1"></script>	</head>
	<body id="body-login">
		<noscript>
	<div id="nojavascript">
		<div>
			This application requires JavaScript for correct operation. Please <a href="https://www.enable-javascript.com/" target="_blank" rel="noreferrer noopener">enable JavaScript</a> and reload the page.		</div>
	</div>
</noscript>
					<input type="hidden" id="initial-state-core-versionHash" value="IjBjNjEzMzdhIg==">
					<input type="hidden" id="initial-state-comments-maxAutoCompleteResults" value="MTA=">
				<div class="wrapper">
			<div class="v-align">
									<header role="banner">
						<div id="header">
							<div class="logo"></div>
						</div>
					</header>
								<main>
					<h1 class="hidden-visually">
						Generico Cloud					</h1>
					<div class="guest-box wide">
	<h2>Internal Server Error</h2>
	<p>The server was unable to complete your request.</p>
	<p>If this happens again, please send the technical details below to the server administrator.</p>
	<p>More details can be found in the server log.</p>

	<h3>Technical details</h3>
	<ul>
		<li>Remote Address: 64.227.0.5</li>
		<li>Request ID: UEAxYa4WsqJoHaHyAX2b</li>
			</ul>

	</div>
				</main>
			</div>
		</div>
		<footer role="contentinfo" class="guest-box">
			<p class="info">
				<a href="https://genericoep.com" target="_blank" rel="noreferrer noopener" class="entity-name">Generico Cloud</a> – a safe home for all your data			</p>
		</footer>
	</body>
</html>
]
	at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.buildCause(RequestHelper.java:68)
	... 4 more

@desperateCoder
Copy link
Collaborator

Well, thats quite interesting. We're requesting /index.php/apps/deck/api/v1.1/boards/8/stacks/32/cards/1737 and get a 500 HTML page as response?! This is most likely a server configuration thing.

Can you see anything in the logs with the following Request-ID (mentioned on the http error page)?

Request ID: UEAxYa4WsqJoHaHyAX2b

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

yeah nothing in the logs with that request id

@desperateCoder
Copy link
Collaborator

As you can see here the URL is constructed correctly and there is nothing i can or should change to this request. Something is behaving really weird in your setup.

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

maybe im looking in the wrong place for the logs? i'm just using the built in nextcloud logging in admin settings...

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

maybe it has something to do with the snap version of nextcloud?

@desperateCoder
Copy link
Collaborator

maybe im looking in the wrong place for the logs? i'm just using the built in nextcloud logging in admin settings...

Here's what I found regarding this: https://help.nextcloud.com/t/getting-500-with-request-id-but-cannot-find-logs/146536

Regarding snap: I can't really tell, never tried it. If I remember correctly we had issues with the snap version in the past, but I'm not really sure it is related to deck or a different project. If you have a non-snap version running somewhere, feel free to test it there

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

ok will spin up a standard install load my data and try there... but if i recall i do believe this is a non issue on the docker and regular installs... been awhile.

oh also just to clear this... i do not have these issues with ios or the other android client on this one...

@desperateCoder
Copy link
Collaborator

i do not have these issues with ios or the other android client on this one...

I think you're referring to the nextcloud client itself? If yes: sure you don't. They are highly optimated and get their data with a handful of calls to an API that serves for this purpose only. Plus: No offline capabilities. We fetch our data at the initial sync by submitting a sh!tload of calls to the server, which result in even more calls (give me all boards -> ok, now give me all stacks -> now all cards -> now all card-related data and so on). To be able to get all the data in a reasonable time, we need to parallelize things, which leads to an insane amount of complexity, getting all the threads together. The load for the client AND the server are unlikely higher in our case. If I can't fix it this way, I'm actually thinking about contributing an export-feature to the server side, that can output the whole data at once. This would solve many problems at once. But this also could lead to performance-issues on the server side, also because my knowledge about PHP is quite antique. But I'll first try to fix this in the "standard" way, didn't see any constraint violation in the last DEV-version so far.

@TtuxX
Copy link

TtuxX commented Jan 3, 2024

Hey guys,

I finally found some time to dig further into this.

Can you please try the following DEV version of the app and see if it changes anything for you?

༼つಠ益ಠ༽つ ─=≡ΣO)) APK

Please try and report back.

Hi there and Happy New Year! :)
I tried this version and I don't have errors anymore, let's rather say that it randomly stalls during import of the 39 decks. It stalls at a random deck (30 or 36 around this) and does not throw any error.
It even once successfully imported all the cards.
I am not able to reproduce the behavior consistently

@desperateCoder
Copy link
Collaborator

Hi @TtuxX, thanks for testing and also happy new year! ❤️

That's great news already! Regarding the stalling: no matter how long you wait, nothing is moving forward? Did the screen turn off while importing? This could be caused by an Android feature, we can address that in a different issue. For now I'd be happy if the initial sync of 39 boards keeps working consistently.

Can you try the initial sync a couple of times with the screen on and see if you run into constraint violations?

In case it works consistently, this means we're at least perform better than before

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

also if i recall i was getting the same issues on one of your test servers last april... i can dig up in my emails to see which one....

@Gobytego
Copy link

Gobytego commented Jan 3, 2024

@desperateCoder ok found the email chain from april 26th 2023 i can fwd to you if that helps get back to where we left off...

@TtuxX
Copy link

TtuxX commented Jan 3, 2024

Hi @TtuxX, thanks for testing and also happy new year! ❤️

That's great news already! Regarding the stalling: no matter how long you wait, nothing is moving forward? Did the screen turn off while importing? This could be caused by an Android feature, we can address that in a different issue. For now I'd be happy if the initial sync of 39 boards keeps working consistently.

Can you try the initial sync a couple of times with the screen on and see if you run into constraint violations?

In case it works consistently, this means we're at least perform better than before

Thanks for your help and sorry for dragging you once again into the Android nightmare haha

I tried import (& app data reset) like 6 times and this is what I got:

  • No more error message at any stage
  • I'd say import worked 3/6 times
  • Import would also stall the remaining half of time, usually (but not always) on the same deck numbers
  • For these tests, sync was always done with screen on from end to end
  • When on a stalled import, the longest time I waited was like 10 minutes, and I stopped the process as nothing was happening again.

I have not looked at the code, but for debugging purpose, could a solution be to set a timeout+retry for each deck import, with a test of 2 max failed imports that would then throw an error?

@desperateCoder
Copy link
Collaborator

found the email chain from april 26th 2023

@Gobytego yep, also found it. I'll have a look these days

No more error message at any stage
I'd say import worked 3/6 times

@TtuxX At least something i guess 😅

For these tests, sync was always done with screen on from end to end

sounds like the thread pool had a deadlock then, I'll have a look.

I have not looked at the code, but for debugging purpose, could a solution be to set a timeout+retry for each deck import, with a test of 2 max failed imports that would then throw an error?

Thats similar to what i already did for this issue, but not for the whole sync, just for the failing parts. A full retry would most probably run into similar problems.

@desperateCoder
Copy link
Collaborator

I think i found something on the server side regarding this error message:

OCA\Deck\BadRequestException: userId must be provided and must be not empty

According to this issue comment (#1560 (comment)), we get the following error (and stack):

{
  "reqId": "aLbVml1E6DfFz8GeNzwV",
  "level": 3,
  "time": "2024-01-08T20:37:52+00:00",
  "remoteAddr": "82.101.240.101",
  "user": "--",
  "app": "index",
  "method": "GET",
  "url": "/index.php/apps/deck/api/v1.1/boards/9/stacks/30/cards/263?",
  "message": "userId must be provided and must be not empty",
  "userAgent": "Mozilla/5.0 (Android) Nextcloud-android/3.26.0",
  "version": "28.0.1.1",
  "exception": {
    "Exception": "OCA\\Deck\\BadRequestException",
    "Message": "userId must be provided and must be not empty",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/custom_apps/deck/lib/Validators/BaseValidator.php",
        "line": 85,
        "function": "validate",
        "class": "OCA\\Deck\\Validators\\BaseValidator",
        "type": "->",
        "args": [
          [
            null
          ]
        ]
      },
      {
        "file": "/var/www/html/custom_apps/deck/lib/Service/AssignmentService.php",
        "line": 108,
        "function": "check",
        "class": "OCA\\Deck\\Validators\\BaseValidator",
        "type": "->",
        "args": [
          [
            null
          ]
        ]
      },
      {
        "function": "__construct",
        "class": "OCA\\Deck\\Service\\AssignmentService",
        "type": "->",
        "args": [
          [
            "OCA\\Deck\\Service\\PermissionService"
          ],
          [
            "OCA\\Deck\\Db\\CardMapper"
          ],
          [
            "OCA\\Deck\\Db\\AssignmentMapper"
          ],
          [
            "OCA\\Deck\\Db\\AclMapper"
          ],
          [
            "OCA\\Deck\\Notification\\NotificationHelper"
          ],
          [
            "OCA\\Deck\\Activity\\ActivityManager"
          ],
          [
            "OCA\\Deck\\Db\\ChangeHelper"
          ],
          [
            "OC\\EventDispatcher\\EventDispatcher"
          ],
          [
            "OCA\\Deck\\Validators\\AssignmentServiceValidator"
          ],
          null
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 83,
        "function": "newInstanceArgs",
        "class": "ReflectionClass",
        "type": "->",
        "args": [
          [
            [
              "OCA\\Deck\\Service\\PermissionService"
            ],
            [
              "OCA\\Deck\\Db\\CardMapper"
            ],
            [
              "OCA\\Deck\\Db\\AssignmentMapper"
            ],
            [
              "OCA\\Deck\\Db\\AclMapper"
            ],
            [
              "OCA\\Deck\\Notification\\NotificationHelper"
            ],
            [
              "OCA\\Deck\\Activity\\ActivityManager"
            ],
            [
              "OCA\\Deck\\Db\\ChangeHelper"
            ],
            [
              "OC\\EventDispatcher\\EventDispatcher"
            ],
            [
              "OCA\\Deck\\Validators\\AssignmentServiceValidator"
            ],
            null
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 128,
        "function": "buildClass",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          [
            "ReflectionClass",
            "OCA\\Deck\\Service\\AssignmentService"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 146,
        "function": "resolve",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          "OCA\\Deck\\Service\\AssignmentService"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 468,
        "function": "query",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          "OCA\\Deck\\Service\\AssignmentService"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 440,
        "function": "queryNoFallback",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->",
        "args": [
          "OCA\\Deck\\Service\\AssignmentService"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 96,
        "function": "query",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->",
        "args": [
          "OCA\\Deck\\Service\\AssignmentService",
          true
        ]
      },
      {
        "function": "OC\\AppFramework\\Utility\\{closure}",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 83,
        "function": "array_map",
        "args": [
          [
            "Closure"
          ],
          [
            [
              "ReflectionParameter",
              "appName"
            ],
            [
              "ReflectionParameter",
              "request"
            ],
            [
              "ReflectionParameter",
              "cardService"
            ],
            "*** sensitive parameters replaced ***",
            [
              "ReflectionParameter",
              "userId"
            ]
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 128,
        "function": "buildClass",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          [
            "ReflectionClass",
            "OCA\\Deck\\Controller\\CardApiController"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 146,
        "function": "resolve",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          "OCA\\Deck\\Controller\\CardApiController"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 468,
        "function": "query",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          "OCA\\Deck\\Controller\\CardApiController"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 440,
        "function": "queryNoFallback",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->",
        "args": [
          "OCA\\Deck\\Controller\\CardApiController"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 163,
        "function": "query",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->",
        "args": [
          "OCA\\Deck\\Controller\\CardApiController"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Deck\\Controller\\CardApiController",
          "get",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "1.1",
            "9",
            "30",
            "263",
            "deck.card_api.get"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1069,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/deck/api/v1.1/boards/9/stacks/30/cards/263"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 39,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/custom_apps/deck/lib/Validators/BaseValidator.php",
    "Line": 66,
    "message": "userId must be provided and must be not empty",
    "exception": {},
    "CustomMessage": "userId must be provided and must be not empty"
  }
}

It seems that the dependency injection at the server side is kind of broken. The request is fine, but Injecting the (for this usecase unrelated) AttachmentService will fail, see:

@juliushaertl can you check on this please? I got the feeling that I don't do anything wrong here (see the called URL in JSON above, especially the "user": "--", part). The weird thing: it doesn't happen always as it seems... If you need any help to track down this issue, maybe the affected users (@Gobytego @xarinatan) could help?

@stefan-niedermann
Copy link
Owner

@Gobytego could you also post a list of enabled Nextcloud server apps? Especially looking for TOTP and authentication related stuff. I rembember the "HTML page as response" in combination with authentication issues caused by some super duper groovy security snake oil apps on the corresponding instances 😄

@Gobytego
Copy link

I don't have any of the auth stuff installed

@juliushaertl
Copy link
Collaborator

juliushaertl commented Jan 18, 2024

@desperateCoder I'm not sure how that could happen yet. It would be good to see if a properly crafted manual request shows the same issue (of course with adjusting the url and ids):

curl -X GET -u "userid:password" 'https://nextcloud.local/index.php/apps/deck/api/v1.1/boards/1/stacks/1/cards/1?format=json' -H 'OCS-APIRequest: true' -v

At least I cannot replicate any issue with valid credentials, with invalid ones or by leaving out I get the same error, but that would be expected from my point of view.

@xarinatan
Copy link

@desperateCoder I'm not sure how that could happen yet. It would be good to see if a properly crafted manual request shows the same issue (of course with adjusting the url and ids):

curl -X GET -u "userid:password" 'https://nextcloud.local/index.php/apps/deck/api/v1.1/boards/1/stacks/1/cards/1?format=json' -H 'OCS-APIRequest: true' -v

At least I cannot replicate any issue with valid credentials, with invalid ones or by leaving out I get the same error, but that would be expected from my point of view.

I've tried to run this as a test since I'm also affected by the issue. I have 2FA though, so if I use my main password I get an "Internal Server Error" which is probably expected. If I'm using a generated app password as a test, I get a seemingly normal JSON reply:

...other TLS/HTTP header exchanges...
< 
* Connection #0 to host nextcloud.dragonhive.net left intact
{"id":1,"title":"Example Task 3","description":"","stackId":1,"type":"text","lastModified":1640021696,"lastEditor":null,"createdAt":1639266161,"labels":[],"assignedUsers":[],"attachments":[{"id":1,"cardId":1,"type":"file","data":"Example.md","lastModified":1638818431,"createdAt":1639266210,"createdBy":"alexanderypema@gmail.com","deletedAt":0,"extendedData":{"path":"\/Documents\/Example.md","fileid":263,"data":"Example.md","filesize":1095,"mimetype":"text\/markdown","info":{"dirname":".","basename":"Example.md","extension":"md","filename":"Example"},"hasPreview":true,"permissions":19,"attachmentCreator":{"displayName":"Anthropy","id":"alexanderypema@gmail.com","email":"alexanderypema@gmail.com"}}}],"attachmentCount":1,"owner":{"primaryKey":"alexanderypema@gmail.com","uid":"alexanderypema@gmail.com","displayname":"Anthropy","type":0},"order":0,"archived":true,"done":null,"duedate":null,"deletedAt":0,"commentsUnread":0,"commentsCount":0,"ETag":"763babd1648fc1acd1ec2bd8f373a4cb","overdue":0}

It could be that only certain boards/cards/data causes the error? Although I managed to get at least one other card from my boards:

* Connection #0 to host nextcloud.dragonhive.net left intact
{"id":548,"title":"Build out HydraChimera","description":"- [ ] to support general processes\n- [ ] to support stateful processes\n- [ ] migrate the keyvalue storage into the stateful processes\n- [ ] add a messagebus to the stateful processes","stackId":65,"type":"plain","lastModified":1705260660,"lastEditor":null,"createdAt":1703517866,"labels":[],"assignedUsers":[],"attachments":[],"attachmentCount":0,"owner":{"primaryKey":"alexanderypema@gmail.com","uid":"alexanderypema@gmail.com","displayname":"Anthropy","type":0},"order":0,"archived":false,"done":null,"duedate":null,"deletedAt":0,"commentsUnread":0,"commentsCount":0,"ETag":"0ac9dd11b5d22309f32e6abcb1a2c4ab","overdue":0}[

Is there a way to log into the Deck app using an app password? I could only see auth methods that interacted with the main Nextcloud apps (normal and dev versions), which makes it hard for me to test whether it's caused by authentication shenanigans (the Nextcloud app doesn't seem to allow me to log in with an App Password).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants