Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling queue causes Unable to JSON encode payload. Error (5) #885

Closed
danharper83 opened this issue Dec 21, 2023 · 7 comments · Fixed by #893
Closed

Enabling queue causes Unable to JSON encode payload. Error (5) #885

danharper83 opened this issue Dec 21, 2023 · 7 comments · Fixed by #893

Comments

@danharper83
Copy link

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

@parallels999
Copy link

Your json is not utf-8, check db encoding, json encoding

@danharper83
Copy link
Author

danharper83 commented Dec 22, 2023

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.

@parallels999
Copy link

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

@djibrilcolynat
Copy link

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

@parallels999
Copy link

parallels999 commented Dec 30, 2023

Could you try #893

#884 (comment)

@djibrilcolynat
Copy link

@parallels999 It didn't work either. Have to temporarily stick to v13.5.1 in production.

@MortenDHansen
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants