What seems to be the problem:
I’m seeing this in production randomly using the latest Livewire
Livewire\Exceptions\CorruptComponentPayloadException
Livewire encountered corrupt data when trying to hydrate the [auth.login] component. Ensure that the [name, id, data] of the Livewire component wasn’t tampered with between requests.
Steps to Reproduce:
- Unable to consistently reproduce, happens randomly in production every so often.
Are you using the latest version of Livewire: Yes
Do you have any screenshots or code examples:
<?php
namespace App\Http\Livewire\Auth;
use Livewire\Component;
use Illuminate\Support\Facades\Auth;
class Login extends Component
{
/** @var string */
public $email = '';
/** @var string */
public $password = '';
/** @var bool */
public $remember = false;
public $returnTo = null;
protected $queryString = ['returnTo'];
public function authenticate()
{
$credentials = $this->validate([
'email' => ['required', 'email'],
'password' => ['required'],
]);
// Check for is active
$details = array_merge($credentials, ['is_active' => 1]);
if (! Auth::attempt($details, $this->remember)) {
$this->addError('email', trans('auth.failed'));
return;
}
// Grab the default for the user type
$default = (new \App\Http\Controllers\Auth\LoginController)->redirectTo(false);
// Helper to return to a specific page on request
if (isset($this->redirectTo) && ! is_null($this->returnTo)) {
$default = url($this->returnTo);
}
redirect()->intended($default);
}
public function render()
{
return view('livewire.auth.login')
->extends('theme::layouts.auth')
->section('content');
}
}
I mentioned this in the Livewire Discord, and it was mentioned to log the $fingerprint
and $memoSansChildren
from the ComponentChecksumManager.php
and I was going to extend/override the class to log this as Sentry context, but it was mentioned I could somehow capture this in a middleware.
Ideally I didn’t want to extend/override the core Livewire class, any suggestions on how to debug this as it appears randomly on production for no absolute reason, at least from what I can tell.