Files
zitadel/internal/notification
Zach Hirschtritt e86bd3a2f2 fix: don't trigger session projection on notification handling (#10298)
# Which Problems Are Solved

There is an outstanding bug wherein a session projection can fail to
complete and an session OTP challenge is blocked because the projection
doesn't exist. Not sure why the session projection can fail to persist -
I can't find any error logs or failed events to crosscheck. However, I
can clearly see the session events persisted with user/password checks
and the OTP challenged added on the session - but no session projection
on sessions8 table.

This only seems to come up under somewhat higher loads - about 5
logins/s and only for about 1% of cases. (where a "login" is:
authRequest, createSession, getAuthCodeWithSession, tokenExchange, and
finally, otpSmsChallenge...💥).

# How the Problems Are Solved

This is only half a fix, but an important one as it can block login for
affected users. Instead of triggering and checking the session
projection on notification enqueuing, build a write model directly from
the ES.

# Additional Changes

# Additional Context

This doesn't touch the "legacy" notification handler as to limit the
blast radius of this change. But might be worth adding there too.

The test is difficult to update correctly so is somewhat incomplete. Any
suggestions for refactoring or test helpers I'm missing would be
welcome.

Co-authored-by: Silvan <27845747+adlerhurst@users.noreply.github.com>
2025-08-08 09:53:11 +02:00
..