I'm sending messages via the Gmail API. In particular, I am trying to send 5-7 emails from the same account to different users (1 each) within about 2 seconds.
About 8% of those emails are failing with this error:
&googleapi.Error{
Code:500,
Message:"Backend Error", Body:`{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 500,
"message": "Backend Error"
}
}`,
Header:http.Header(nil),
Errors:[]googleapi.ErrorItem{
googleapi.ErrorItem{Reason:"backendError", Message:"Backend Error"}
}
}
It doesn't seem like it's specific to a particular account, as 6/7 emails may succeed.
I'm hesitant to retry this for fear of sending 2 emails to the same person.
Is there any way to tell whether this message is safe to retry?
"code": 500, "message": "Backend Error"
Is basically an issue with Google server. Either the request you are making took to long or the server preforming the request is busy and the request again took to long. It doesn't sound like what you are doing should be causing the problem.
Tips when not to run: Don't run on the hour you will be completing with everyone who has cron jobs set up also don't run at midnight (PDT) as this is when quotas reset and again you will be completing with everyone who blew out yesterdays quota.
Solution:
The normal solution is to wait a few seconds then send the same request again. (Implementing Exponential Backoff)
The flow for implementing simple exponential backoff is as follows.
Make a request to the API
Receive an error response that has a retry-able error code
Wait 1s + random_number_milliseconds seconds
Retry request
Receive an error response that has a retry-able error code
Wait 2s + random_number_milliseconds seconds
Retry request
Receive an error response that has a retry-able error code
Wait 4s + random_number_milliseconds seconds
Retry request
Receive an error response that has a retry-able error code
Wait 8s + random_number_milliseconds seconds
Retry request
Receive an error response that has a retry-able error code
Wait 16s + random_number_milliseconds seconds
Retry request
If you still get an error, stop and log the error.
Sometimes it can happen before send and sometimes after send.
I logged the "To" and "From" from five different email attempts that all received a 500 Backend Error. None of these attempts made it to the "Sent" folder of my inbox. I conclude that they were never sent, and it's safe to retry these messages. However, other people in the comments (see below) indicated that the messages actually made it to the remote mailbox, and it's not safe to retry.
Related
Occasionally the bot sends a timeout error. It seems that it happens by requests with larger amout of data. Is it possible to increase the timeout or cash buffer?
Request
https://directline.botframework.com/v3/directline/conversations/xxx/activities
Response
{
"error": {
"code": "BotError",
"message": "Failed to send activity: bot timed out"
},
"httpStatusCode": 504
}
Payload
17. x-ms-bot-agent:
DirectLine/3.0 (directlinejs; WebChat/4.9.0 (Full))
18. x-requested-with:
XMLHttpRequest
4. Request Payloadview source
1. {,…}
1. channelData: {clientActivityID: "", clientTimestamp: "2020-06-05T06:57:43.001Z"}
2. channelId: "webchat"
3. from: {id: "",…}
4. locale: "en-US"
5. text: "nohy"
6. textFormat: "plain"
7. timestamp: "2020-06-05T06:57:43.045Z"
8. type: "message"
Any idea guys?
You cannot increase the timeout limit. This is a limit imposed by the Direct Line service, and is set in place for performance and stability reasons. The timeout happens because your bot/code takes too long to respond back to the service, not because of how much data (unless that large data is contributing to the length of time to reply).
You should investigate your bot and those portions of it that take longer, to see if you can decrease the time taken. If you know that there are areas (say external calls to other services, etc) that will take a long time and is unavoidable; then you should implement proactive messaging to remedy that.
https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-proactive-message?view=azure-bot-service-4.0&tabs=csharp
https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/16.proactive-messages
I am creating agent using dialogflow with webhook. Facing problem in webhook timeout:
webhook_status { code: 4 message: "Webhook call failed. Error: Request
timeout." }
kindly help me to increase webhook timeout time.
There is no way you can increase Time Out for webhook. Your webhook should respond back within 5 seconds (see Limits here)
Sending emails that way used to work fine but the other day, in the mail of a script sending a lot of emails, I started getting this error for every email sent:
"Expected response code 250 but got code "", with message """
I cannot find any help on the Amazon SES website.
Many thanks.
in my case it was because of email processing handled by queue worker, and it looks like transport is open until worker process end, so Swiftmailer send many emails in long-running connection and at some point SMTP server closes connection on timeout.
this code helps if used before $this->mailer->send()
if ($this->mailer->getTransport()->isStarted()) {
$this->mailer->getTransport()->stop();
}
I have received the following error when trying to save a DSX Scheduled Job:
Job schedule entry could not be created. Status code: 500
Screenshot of the error message:
I've tried about six times over the last few hours and have consistently received the above error message.
Debugging via the browser network inspection tool I can see:
{
"code":"CDSX.N.1001",
"message":"The service is not responding, try again later.",
"description":"",
"httpMethod":"POST",
"url":"https://batch-schedule-prod.spark.bluemix.net:12100/schedules",
"qs":"",
"body":"While attempting to get Bluemix Token from BlueIDToken, unable to retrieve AccessToken, failed with status 400 Bad Request, message = {\"error\":\"invalid_grant\",\"error_description\":\"A redirect_uri can only be used by implicit or authorization_code grant types.\"} Entity: {\"error\":\"invalid_grant\",\"error_description\":\"A redirect_uri can only be used by implicit or authorization_code grant types.\"}",
"statusCode":500,
"duration":666,
"expectedStatusCode":201
}
As per Charles comment, the functionality is working ok now. I guess if this happens to another user some time in the future they should contact support.
I've got my Chromecasts whitelisted and was doing some sender and receiver app development.
Ran into this strange problem of a callback returning "Request timeout" after a second or two when after a few more seconds, the media started playing on the Chromecast device.
castApi.loadMedia(currentActivityId, loadRequest, launchCallback);
The status launchCallback returned was:
cast.MediaResult {
activityId: "ao4hr3w1a1gw",
status: null,
success: false,
errorString: "Request timeout"
}
This happens sporadically, depending on how fast the video load on the Chromecast device. But the timeout (probably 1 to 2 seconds) happens so quickly that it returns a failure about half the time. Am I doing something wrong here?
When it successfully runs your media (after initial timeout error message), do you get an updated successful message via your callback?