Hi all, On my self-hosted Ory Kratos instance v25...
# ory-selfhosting
r
Hi all, On my self-hosted Ory Kratos instance v25.4.0, i am trying to setup a post registration webhook to send the UUID and email of the registered user to my backend in the following jsonnet function:
Copy code
function(ctx) {
  uuid: ctx.identity.id,
  email: ctx.identity.traits.email,
  state: ctx.identity.state,
  created_at: ctx.identity.created_at,
}
My kratos config is as follows (simplified to focus on the problem):
Copy code
version: v25.4.0

selfservice:

  methods:
    password:
      enabled: true

  flows:
    registration:
      lifespan: 10m
      ui_url: <http://localhost/signup>
      after:
        password:
          hooks:
            - hook: session
        hooks:
          - hook: web_hook
            config:
              id: "user-registration"
              url: <http://localhost:8080/users/register>
              method: POST
              body: file:///etc/config/kratos/registration-webhook.jsonnet
              can_interrupt: true 
              response:
                ignore: false
                parse: false
But on Kratos logs, I get two logs saying one pre and one post hook runs: entry looks like this
ExecutePostRegistrationPostPersistHook
, However, no requests come to the backend. If I move them under
password
, they come to the backend server, but they don’t contain the
identity.id
, it is just an empty UUID, because it gets executed as
PostRegistrationPrePersistHook
. Even setting
config.response.parse
to
false
I do not get the
identity.Id
filled in, which was suggested in previous versions as a solution. Has anyone experienced the same, and how can we enable to get these
ExecutePostRegistrationPostPersistHook
to actually run? Thanks!
a
You need to set the "ignore: true" to receive a valid identityId. My understanding is that the identityId is only sent once the identity has been persisted and if you set "ignore: false", then you tell Kratos to wait for the success of the webhook before persisting the identityId Setting the ignore to "true", this implies that you need to implement some resiliency / fault-tolerance feature if you fail to accept the post-registration call (as that would mean the identity has been saved in Ory Kratos but not in your backend).
r
Thanks for the response. It did work with
ignore: true
. Thanks!