docspell icon indicating copy to clipboard operation
docspell copied to clipboard

Unable to see webhooks

Open mikedolx opened this issue 10 months ago • 5 comments

Hi,

I was playing around with webhooks and set up some notification forwarding.

After some time I realized, that there are no webhooks visible in the docspell-ui. I remember clicking on the save button multiple times.

Now, when I edit a document/item I get four notifications. I guess, I had set up four webhooks, but can't see any of those.

Any idea, how I can either delete all webhooks, or make them visible again?

I'm running in the latest docspell 0.41.0 on docker-compose.

Any hints appreciated.

mikedolx avatar Apr 15 '24 11:04 mikedolx

Allright, after diggin a bit into it i could get the following errors.

This is what i get from the chrome developer-console: Bildschirmfoto 2024-04-15 um 17 59 59

And this is what i can see from the docker-compose logs:

docspell-restserver | java.lang.Exception: Hook 'FGTzoaUQ1vf-jcMwDLx2hWw-MadYsUVS8on-j4ftUFjRnVm' has no associated channels!
docspell-restserver | 	at docspell.store.records.RNotificationHookChannel$.$anonfun$allOfNel$4(RNotificationHookChannel.scala:174)
docspell-restserver | 	at scala.Option.getOrElse(Option.scala:201)
docspell-restserver | 	at docspell.store.records.RNotificationHookChannel$.$anonfun$allOfNel$2(RNotificationHookChannel.scala:174)
docspell-restserver | 	at cats.free.Free.$anonfun$step$1(Free.scala:76)
docspell-restserver | 	at cats.free.Free.step(Free.scala:77)
docspell-restserver | 	at cats.free.Free.$anonfun$foldMap$1(Free.scala:164)
docspell-restserver | 	at cats.data.KleisliFlatMap.$anonfun$tailRecM$2(Kleisli.scala:701)
docspell-restserver | 	at cats.StackSafeMonad.tailRecM(StackSafeMonad.scala:37)
docspell-restserver | 	at cats.StackSafeMonad.tailRecM$(StackSafeMonad.scala:36)
docspell-restserver | 	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
docspell-restserver | 	at $anonfun$tailRecM$1 @ doobie.util.transactor$Transactor$$anon$4.$anonfun$apply$4(transactor.scala:165)
docspell-restserver | 	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
docspell-restserver | 	at $anonfun$tailRecM$1 @ doobie.util.transactor$Transactor$$anon$4.$anonfun$apply$4(transactor.scala:165)
docspell-restserver | 	at $anonfun$tailRecM$1 @ doobie.util.transactor$Transactor$$anon$4.$anonfun$apply$4(transactor.scala:165)
docspell-restserver | 	at blocking @ fs2.io.file.FilesCompanionPlatform$AsyncFiles.exists(FilesPlatform.scala:219)
docspell-restserver | 	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
docspell-restserver | 	at $anonfun$tailRecM$1 @ doobie.util.transactor$Transactor$$anon$4.$anonfun$apply$4(transactor.scala:165)
docspell-restserver | 	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
docspell-restserver | 	at $anonfun$tailRecM$1 @ doobie.util.transactor$Transactor$$anon$4.$anonfun$apply$4(transactor.scala:165)
docspell-restserver | 	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
docspell-restserver | 	at $anonfun$tailRecM$1 @ doobie.util.transactor$Transactor$$anon$4.$anonfun$apply$4(transactor.scala:165)
docspell-restserver | 	at $anonfun$tailRecM$1 @ doobie.util.transactor$Transactor$$anon$4.$anonfun$apply$4(transactor.scala:165)
docspell-restserver | 	at delay @ docspell.logging.impl.ScribeWrapper$Impl.log(ScribeWrapper.scala:29)
docspell-restserver | 	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
docspell-restserver | 	at $anonfun$tailRecM$1 @ doobie.util.transactor$Transactor$$anon$4.$anonfun$apply$4(transactor.scala:165)

Not sure if this could be an reverse-proxy config. I've been playing around a bit with it, so here is the config (with some out commented lines)


<VirtualHost *:80>
 ServerName docs.fuchscloud.de
 ProxyPreserveHost On
 ProxyPass / http://192.168.127.232:7880/
 ProxyPassReverse / http://192.168.127.232:7880/
 RewriteEngine on
 # RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
 RewriteCond %{SERVER_NAME} =docs.fuchscloud.de
 RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>

<VirtualHost *:443>
 ServerName docs.fuchscloud.de
 ProxyPreserveHost On

 #ProxyPass /api/v1/sec/ws ws://192.168.127.232:7880/api/v1/sec/ws
 #ProxyPassReverse /api/v1/sec/ws ws://192.168.127.232:7880/api/v1/sec/ws
 #ProxyPass /(.*) http://192.168.127.232:7880/$1
 ProxyPass / http://192.168.127.232:7880/
 #ProxyPassReverse /(.*) http://192.168.127.232:7880/$1
 ProxyPassReverse / http://192.168.127.232:7880/
 RewriteEngine on
 RewriteCond %{SERVER_NAME} =docs.fuchscloud.de
 # RewriteRule ^ http://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
 # RewriteRule /api/v1/sec/ws ws://192.168.127.232:7880/api/v1/sec/ws [P,L]

 Include /etc/apache2/sites-enabled/local-network.config
 Include /etc/apache2/ssl-options.conf

</VirtualHost>

mikedolx avatar Apr 15 '24 16:04 mikedolx

Hi @mikedolx oh that doesn't look nice. For some reason you have a notification hook without a "channel". I think it would be good to check the table notification_hook. there are foreign keys into other tables for a certain channel, like notification_channel_gotify etc. The problematic hook has id FGTzoaUQ1vf-jcMwDLx2hWw-MadYsUVS8on-j4ftUFjRnVm - perhaps you can see in the db some obvious link problem. It would be interesting how you came to this state.

eikek avatar Apr 16 '24 19:04 eikek

Hi @eikek ,

thanks für the reply. It took me some time, to get pgadmin attached to the db, but here i am now. Please find below a screenshot of my notification_hook table. You may tell me if something looks odd 😁

grafik

EDIT: To answer your question: I don't actually know how i get into this state. I just created one webhook after another. As they did not show up in the ui i thought, that something must be wrong, so i created another one. This issue persists a bit longer, as you can see by the creation date of the hooks. Nevertheless, if i edit a document, i get bombarded by notifications triggered by the webhooks. I think i could workaround the notification bombardement by creating another webhook, that points to a different http-address.

mikedolx avatar Apr 16 '24 20:04 mikedolx

I'm sorry, I'd need another table :) The table you showed is the main one and you can see the first row is the hook that is in a bad state (it's id is mentioned in the exception in the logs). If you don't hang on to it too strongly you can just delete that row. Then the error won't appear anymore.

For the cause, there is another table, connecting channels to a hook. So that one hook can use multiple channels to send its messages (gotify, matrix etc). This table is notification_hook_channel. It probably doesn't have an entry for the FGTzoaUQ1vf-… notification hook (or all channel_xcolumns are null).

The message bombardment is probably caused by too many hooks triggered for the same event. If you like to start from scratch, you can empty the table notification_hook_channel and afterwards notification_hook.

eikek avatar Apr 17 '24 05:04 eikek

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. This only applies to 'question' issues. Always feel free to reopen or create new issues. Thank you!

github-actions[bot] avatar Jun 30 '24 02:06 github-actions[bot]