Fatal error: Uncaught Mailgun\Connection\Exceptions\GenericHTTPError: An HTTP Error has occurred! Check your network connection and try again
Hi, I have integrated mailgun in my php project and it was working fine. I was using validate email function and it was all set but now its giving me this error and I am frustrated solving this but don't have a clue that what's wrong with this as all the credentials are same and every line of code is same but this is not working . I even tried new installs as well and new server too but nothing. send mail function is working fine but not validate email. Help me please, have to deliver this asap
An HTTP Error has occurred! Check your network connection and try again.
This happens for me as well. Perhaps once or twice a month and it kills my daily reports.
May I ask what's the error message thrown by that error, so someone can investigate it?
Also, maybe you can add a try ... catch ... to process the error in case of failure
Hi , Thank you for your replies but it started working after a while . I don't know what triggered what but it finally worked.
catch (Exception $e)
{
echo 'Error: '.$e->getMessage().PHP_EOL;
}
Echos out...
Error: An HTTP Error has occurred! Check your network connection and try again.
It is only intermittent. I have a script that runs daily, and once or twice a month it dies on this error. I suspect it's a temporary response failure from mailgun's API.
Feel free to close this, I just wanted to mention that I also had the problem.
It looks like an API failure, indeed.
Did you try the same case I said above, something like this?
try {
// call
} catch (GenericHTTPError $exception) {
try {
// call
} catch (GenericHTTPError $exception) {
throw $exception;
}
}
Maybe in this case if there is a downtime the 2nd call will work. I have realised about this issue working with another API that returned me DNS or Timeout errors, so when I called the API endpoint again then it worked.
Not the best / clean / nice solution, but it worked...
Yea, I've done that before, and I'll try adding it in. Usually fixes another 90% of the issues when doing that, and then some times it is just flat down. :) I'll try on my own time. Sounds like the original issue is resolved though.
In my case it does not solve the problem it is always the same error, https://i.imgur.com/MIJmddw.png
$result = $this->pubKey->get("address/validate", array('address' => $email));
return $result->http_response_body->is_valid;
What is the root cause of this issue, as services that depend on the address validation API functioning as described are severely impacted?
I get the same thing a fair bit too - for me though it looks like the attachments I was trying to include were too big and it was timing out on part of the transfer.