Skip to content

TypeError in Pulse::rememberUser() (Logout Event)  #364

Closed
@vintagesucks

Description

@vintagesucks

Pulse Version

1.0.0

Laravel Version

11.6.0

PHP Version

8.2.18

Livewire Version

3.4.12

Database Driver & Version

Description

Note: A similar problem was reported in #324, but closed due to lack of reproducibility.


We use Pulse::handleExceptionsUsing() to send silenced exceptions to Sentry via sentry/sentry-laravel like this:

# AppServiceProvider::boot()
Pulse::handleExceptionsUsing(fn (\Throwable $e) => Integration::captureUnhandledException($e));

If a user triggers a Logout event without an active session (for example, already logged out in another tab), this will throw a TypeError:

Laravel\Pulse\Pulse::rememberUser(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Authenticatable, null given

We'd expect Pulse not to throw an error in this case, even if Pulse::handleExceptionsUsing() is used to handle silenced exceptions.

Steps To Reproduce

Reproduction repository: https://github.com/vintagesucks/repro-pulse-rememberuser-typeerror-authenticatable


Setup

composer create-project laravel/laravel repro-pulse-rememberuser-typeerror-authenticatable
cd repro-pulse-rememberuser-typeerror-authenticatable
composer require laravel/jetstream
php artisan jetstream:install inertia --no-interaction
npm install
npm run build
composer require laravel/pulse

Add the following to boot() in app/Providers/AppServiceProvider.php:

\Laravel\Pulse\Facades\Pulse::handleExceptionsUsing(fn (\Throwable $e) => throw($e));

Steps

  • Register
  • Open second application tab (/dashboard)
  • Log out in tab 1
  • Log out in tab 2

Result

Laravel\Pulse\Pulse::rememberUser(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Authenticatable, null given

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions