❓ Support
A alyn jones May 16, 2025

Auth/session not syncing on Laravel 12 – Waterhole creates user_id = null session and fails to detect logged-in user

Hi Waterhole team,

I'm using Waterhole v0.4.12 with Laravel 12.14.1.

Everything is installed and configured according to your official docs:

  • Laravel guard is web
  • App\Models\User implements AuthenticatesWaterhole and HasWaterholeUser
  • toWaterholeUser() returns a valid PendingUser
  • Waterhole's built-in auth is disabled (auth.php)
  • Session driver is database
  • SESSION_DOMAIN is .kinksters.test
  • Waterhole route prefix is /forum
  • Login override is done via ForumRoutes::add() as instructed

✅ Repro Steps:

  1. Log in to the Laravel app via /login
  2. Laravel session is created with user_id = 2
  3. Visit /debug-session — shows auth_user: 2 and correct session key
  4. Visit /forum
  5. A new session is created with user_id = null
  6. Waterhole does not detect the user and redirects to login
  7. Visiting /login returns to /dashboard — infinite loop

🧪 What I've Tried:

  • Rebinding user provider via AppServiceProvider
  • Creating middleware to manually sync session and log user in
  • Manually booting session via a custom service provider
  • Verified guard hashes (login_web_xxx) match via debug tools
  • Upgraded to Laravel 12 and cleared all caches
  • All cookies and session IDs are shared correctly
  • Session ID remains the same between / and /forum

❗Expected:

Waterhole should recognize the logged-in Laravel user and auto-link/create the corresponding wh_users record.


This seems to be caused by Waterhole accessing the auth guard before Laravel has fully restored the session (especially under the Laravel 11+/12 bootstrap/app.php lifecycle).

Any help or patch would be greatly appreciated. I can provide a minimal repro if needed.

Thanks for your hard work on Waterhole — it’s a fantastic project and I really want to use it in production.

🎉 1 Hooray Loading...
3 ⁨3⁩ ⁨comments⁩

⁨3⁩ ⁨Comments⁩

Toby Toby Waterhole Founder May 30, 2025
In reply to A alyn jones

Hi @alyn jones,

Thanks for your patience. I have just tried to reproduce this issue with a fresh Laravel 12 installation but I can't seem to. If you could provide a minimal repro, I'd be happy to have a look.

If you're interested in digging more yourself, you can see Waterhole's middleware stack in src/Providers/RouteServiceProvider.php. The specific middleware that translates app auth into Waterhole auth is AuthenticateWaterhole, which comes after StartSession. Perhaps you could throw a few debug statements in here - find out the value of $originalUser etc.

In reply to Toby Toby

Hello @Toby,
just a quick update for you...
i turns out its an issue with my laravel setup as i was creating a repro for you and it works perfectly fine in the repro but not in my actual app.
im struggling to find what is breaking it in my laravel app.

in the cleanly installed waterhole-repo with fresh laravel 12 install and fresh waterhole it works absolutly fine but in my laravel app with the same setup as your docs it has session issue.

not sure what the problem is.