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

General after registration hooks running after method specific post registration hooks #4367

Open
3 of 5 tasks
FaeyUmbrea opened this issue Mar 29, 2025 · 4 comments
Open
3 of 5 tasks
Labels
bug Something is not working.

Comments

@FaeyUmbrea
Copy link

FaeyUmbrea commented Mar 29, 2025

Preflight checklist

Ory Network Project

No response

Describe the bug

If I configure ory kratos to run hooks, I expect hooks configured in the general "hooks" section of the configuration to be run before the hooks in the method specific sections i.e. "oidc -> hooks" are executed. However, due to the oidc hook executing the "session" hook, the hooks in the "hooks" section do no longer execute. Implying that the execution order is inverted.

Reproducing the bug

  1. Configure kratos to use a web_hook after registration hook.
  2. Configure kratos to use the session hook in the after registration oidc event
  3. Attempt to register using oidc
  4. Behold as the webhook does not execute

Relevant log output

Relevant configuration

registration:
      lifespan: 10m
      ui_url: http://localhost:5173/registration
      after:
        hooks:
          - hook: web_hook
            config:
              url: http://targeturl.com
              method: ""
              body: base64://jsonnet
        oidc:
          hooks:
            - hook: session

Version

v1.3.1

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Docker

Additional Context

No response

@FaeyUmbrea FaeyUmbrea added the bug Something is not working. label Mar 29, 2025
@vinckr
Copy link
Member

vinckr commented Mar 29, 2025

This is documented behaviour: https://www.ory.sh/docs/troubleshooting/troubleshoot-actions and probably wontfix (although I can't speak for the maintainers here)

@FaeyUmbrea
Copy link
Author

Not quite the bug I am reporting on. You'd of course expect the session hook to end the execution of hooks as per that part of the documentation. The unexpected behaviour is that contrary to the flow diagram provided in the documentation, the OIDC hooks seem to run before the ones denoted in the non-specific "hooks" section. So you have to duplicate hooks you want to run for all flows if any of your flows uses the session hook at all

@FaeyUmbrea
Copy link
Author

This is the diagram I am talking about, for reference.
Image

@FaeyUmbrea FaeyUmbrea changed the title General after registration hooks not running if specifc hooks run the session hook first. General after registration hooks running after method specific post registration hooks Mar 30, 2025
@vinckr
Copy link
Member

vinckr commented Mar 30, 2025

Thanks for the clarification, that is indeed not how it should work!

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

No branches or pull requests

2 participants