Hey everone, I'm trying to add some sort of asynch...
# talk-kratos
p
Hey everone, I'm trying to add some sort of asynchronous validation on the self-service registration (basically, querying an API to check if the email can actually register). It seems that the "after registration hook" happens after persist. Is there a way to configure it as a prepersist hook?
j
https://ory-community.slack.com/archives/C012RJ2MQ1H/p1648130108307289?thread_ts=1648127686.243159&cid=C012RJ2MQ1H Unfortunately, no way to do this. I’m looking for a similar workaround as well.
p
Indeed, I didn't see this PR (nor the message from yesterday... 😪 ). Let's ping @User and see whether we can help him?
👍 1
j
I’ll have a lot of free time from 1st-10th of April to help 🙂
l
Thanks. We are finishing internal review and we are going to proceed with the internal tests. There are a lot of changes on the master branch since this PR was created so we need to double check that all functionalities work as intended. What would be nice if someone could re-test after our round of tests since we have a limited resources right now and we might have some biases so fresh test run could uncover some cases we have missed.
p
j
@User I’m free now to help as well. I looked into your PR and it looks good to me. Obviously someone from ORY would have to approve the changes 🙂 Going a step further, we should figure out how to propagate error messages. With this PR I think it would be reported as a system error which would lead to a bad user experience. @User would you guys like to give a suggestion on how would you handle error propagation for webhooks? I’ll have some time to contribute and implement it 🙂
l
We are now starting internal tests so I will let you know how it went. I’m open to suggestions since this is based on my initial idea just to allow to display some validation errors to the user and it seems to work well but it is probably not 100% bullet proof in all cases.
👍 1
p
@User I think there's a problem with your implementation, where hooks will be executed twice (one for pre persist, one for post persist). My PR above fixes that, but it will probably change some things from your side
l
Well it is not exactly problem with my PR I believe this is the issue with how hooks are registered/executed for
pre-
and
post-
persists events.
We have also separate fix for that.
I see. So https://github.com/ory/kratos/pull/2343 is one way to do it. Another one which does not break backward compatibility (if there is one in this case) would be something like this https://github.com/Wikia/kratos/pull/38. I think both are fine
p
Both work indeed
l
Anyway thanks for reminding me about this one. We have this fix on prod but I’ve totally forgot about it and we should have pushed this change to upstream. I hope this will be merged soon!
🙌 1
p
Love wikia/fandom btw 😄
l
Thanks 🙂 We hope to contribute more to Ory ecosystem but lately we are quite busy 😞