Skip to content

feat: set session uuid when creating session #4346#4496

Closed
marchetti554 wants to merge 2 commits intoory:masterfrom
monta-app:feat/set-session-uuid-when-creating-session
Closed

feat: set session uuid when creating session #4346#4496
marchetti554 wants to merge 2 commits intoory:masterfrom
monta-app:feat/set-session-uuid-when-creating-session

Conversation

@marchetti554
Copy link
Copy Markdown

Setting the Session.ID when calling NewInactiveSession() fixes this issue, where the Session ID in webhook requests appears as 00000000-0000-0000-0000-000000000000 because it has not yet been persisted in the database at the time the webhook executes.

Related issue(s)

#4346

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

@marchetti554 marchetti554 requested review from a team and aeneasr as code owners November 5, 2025 13:47
Copy link
Copy Markdown
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! To scale, the database has to pick the primary key, which is why we will never know the ID before the DB has persisted it and why we can't set it here.

We probably should add additional places where we can trigger webhooks, such as pre and post persist. This idea has existed for a while but makes hook configuration just significantly more complex and it's currently shelved on the backlog.

@marchetti554
Copy link
Copy Markdown
Author

@aeneasr I understand :) thank you for the feedback!

@aeneasr
Copy link
Copy Markdown
Member

aeneasr commented Nov 6, 2025

Closing as per #4496 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants