Replies: 1 comment
-
Update: I submitted a PR to the So this issue is resolved. Though I'm still flummoxed how anyone was able to monitor SSL certificates without running into this issue. I still feel like I might be missing something. Eager to hear if anyone has thoughts. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are seeing an error "Unable to JSON encode payload. Error (5): Malformed UTF-8 characters, possibly incorrectly encoded." when trying to use the
monitor:check-certificate
command.Did some troubleshooting, and it appears to happen when the
CertificateCheckSucceeded
event is dispatched here:laravel-uptime-monitor/src/Models/Traits/SupportsCertificateCheck.php
Line 53 in 07ddc04
The certificate check is succeeding, the DB is getting updated with a valid status, but then when this success event is dispatched we get the error:
Illuminate\Queue\InvalidPayloadException Unable to JSON encode payload. Error (5): Malformed UTF-8 characters, possibly incorrectly encoded.
Here is a simple way to reproduce from tinker:
It seems the issue occurs when Laravel tries to serialize the
SslCertificate
instance for the purpose of queueing. And indeed, I can reproduce that pretty easily as well. I can'tjson_encode
the array or serialized string of a certificate:It seems to me that the
SslCertificate
class needs to base64_encode some parts of the certificate data to help with serialization and json encoding. If Idump
the$certificate
I definitely see what appears to be binary data in parts of the certificate data. It makes sense that this can't be directly encoded as json.Does that seem reasonable? Should I submit a pull request to the
spatie/ssl-certificate
package with serialization encoding? Or is there something in my PHP config that would solve this?I feel like I must be missing something if everyone isn't having this issue.
Beta Was this translation helpful? Give feedback.
All reactions