AshAuthentication missing notifications when running Expunger
Eduardo B. Alexandre:
I noticed that, for time to time, AshAuthentication Expunger is running and it will generate a warning because of a missing nofitication for removing tokens.
Here is one of these warnings with the full stacktrace:
Eduardo B. Alexandre:
[warning] Missed 1 notifications in action FeedbackCupcake.Accounts.Token.expunge_expired.
This happens when the resources are in a transaction, and you did not pass
`return_notifications?: true`. If you are in a changeset hook, you can
return the notifications. If not, you can send the notifications using
`Ash.Notifier.notify/1` once your resources are out of a transaction.
(elixir 1.15.5) lib/process.ex:860: Process.info/2
(ash 2.14.6) lib/ash/actions/helpers.ex:239: Ash.Actions.Helpers.warn_missed!/3
(ash 2.14.6) lib/ash/actions/destroy.ex:385: Ash.Actions.Destroy.add_notifications/4
(ash 2.14.6) lib/ash/actions/destroy.ex:118: Ash.Actions.Destroy.do_run/4
(ash 2.14.6) lib/ash/actions/destroy.ex:37: Ash.Actions.Destroy.run/4
(feedback_cupcake 0.1.0) lib/feedback_cupcake/accounts.ex:1: FeedbackCupcake.Accounts.destroy/2
(ash_authentication 3.11.8) lib/ash_authentication/token_resource/actions.ex:215: anonymous fn/5 in AshAuthentication.TokenResource.Actions.expunge_inside_transaction/3
(elixir 1.15.5) lib/enum.ex:4830: Enumerable.List.reduce/3
(elixir 1.15.5) lib/enum.ex:2564: Enum.reduce_while/3
(ecto_sql 3.10.2) lib/ecto/adapters/sql.ex:1352: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4
(db_connection 2.5.0) lib/db_connection.ex:1630: DBConnection.run_transaction/4
(ash_authentication 3.11.8) lib/ash_authentication/token_resource/actions.ex:37: AshAuthentication.TokenResource.Actions.expunge_expired/2
(ash_authentication 3.11.8) lib/ash_authentication/token_resource/expunger.ex:57: AshAuthentication.TokenResource.Expunger.handle_info/2
(stdlib 5.0.2) gen_server.erl:1077: :gen_server.try_handle_info/3
(stdlib 5.0.2) gen_server.erl:1165: :gen_server.handle_msg/6
(stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
zachdaniel:
🤔 interesting….this isn’t a serious issue, but we should address it at some point 🙂
zachdaniel:
Mind opening an issue on ash_authentication?
Eduardo B. Alexandre:
sorry, took me some time: https://github.com/team-alembic/ash_authentication/issues/420
zachdaniel:
Hey, also wanted to check to see if you are on the latest version of ash
Eduardo B. Alexandre:
I believe I was using ash 2.14.6 and ash_authentication 3.11.8 when that warning showed up
zachdaniel:
Ah, yeah okay its not a versions issue. That transaction call needs to ask to return notificatitons and then dispatch them after the transaction.