Enabling queue causes Unable to JSON encode payload. Error (5)
danharper83 opened this issue · 7 comments
After updating to the latest version it seems that the queue is automatically enabled.
This caused all my auditable models to stop saving and return this error:
Unable to JSON encode payload. Error (5): Malformed UTF-8 characters, possibly incorrectly encoded {"userId":1,"exception":"[object] (Illuminate\\Queue\\InvalidPayloadException(code: 0): Unable to JSON encode payload. Error (5): Malformed UTF-8 characters, possibly incorrectly encoded at /app/vendor/laravel/framework/src/Illuminate/Queue/Queue.php:109)
Publishing the config and setting the queue to false solves the issue but it's not clear why this is happening.
laravel/framework v10.38.1
owen-it/laravel-auditing v13.6.3
Thanks Dan
Your json is not utf-8, check db encoding, json encoding
The database is utf8_unicode_ci
Everything works as expected when the queue is turned off, the audits are written to the audit table correctly. This issue only started when I upgraded to the latest version which has the queue configuration set to true
by default.
Difficult to reproduce without the model to verify what data the malformed UTF-8 has, if you can upload an example in a clean installation showing the problem it would be very helpful
I just opened an issue for the same reason. Guys, something broke in new updates. I reverted to version 13.5.1 and things went back working fine. I used binary uuid (Dyryndra/laravel-efficient-uuid), but I notice that the "Malformed character" error comes from the fact that binary uuid in models are not longer casted into string using the custom caster I provided in attributedMotifiers property. So trying to encode bytes in JSON will result in a "Malformed character" error
Could you try #893
@parallels999 It didn't work either. Have to temporarily stick to v13.5.1 in production.
I have released 13.6.4 where the queue feature is disabled by default (as it should have been, sorry). I expect avoiding the serialization for queue should mitigate the problem. If not, let me know and stick to v13.5.1 in production.