resend-php icon indicating copy to clipboard operation
resend-php copied to clipboard

Getting JSON Exception

Open fftfaisal opened this issue 9 months ago • 1 comments

I am using resend laravel sdk to send email using regular mail facades with queue. It uses resend php under the hood. I see in the failed job table it has some email failed to sent and throw this exception. This wont happens every time but frequently. I attached the log

JsonException: Syntax error in /home/forge/www.example.com/vendor/resend/resend-php/src/Transporters/HttpTransporter.php:50
Stack trace:
#0 /home/forge/www.example.com/vendor/resend/resend-php/src/Transporters/HttpTransporter.php(50): json_decode()
#1 /home/forge/www.example.com/vendor/resend/resend-php/src/Service/Email.php(32): Resend\Transporters\HttpTransporter->request()
#2 /home/forge/www.example.com/vendor/resend/resend-php/src/Service/Email.php(44): Resend\Service\Email->create()
#3 /home/forge/www.example.com/vendor/resend/resend-laravel/src/Transport/ResendTransportFactory.php(62): Resend\Service\Email->send()
#4 /home/forge/www.example.com/vendor/symfony/mailer/Transport/AbstractTransport.php(69): Resend\Laravel\Transport\ResendTransportFactory->doSend()

fftfaisal avatar Apr 08 '25 10:04 fftfaisal

Hey @fftfaisal, I am experimenting with improved non-JSON error handling. Would highly appreciate your opinion on it: https://github.com/resend/resend-php/pull/77

jayanratna avatar Jun 06 '25 03:06 jayanratna