postmark.js icon indicating copy to clipboard operation
postmark.js copied to clipboard

Sometimes timing out after 3 minutes

Open Powersource opened this issue 3 years ago • 2 comments

Still investigating this issue so not clear on all the details but this seems to happen >50% of the time but not 100%. Here's one of our logged failed requests (newlines arbitrarily entered to make it easier to read)

START RequestId: 20cbab85-1282-4220-93da-599dcf2aba3a
Version: $LATEST 2022-07-20T17:59:11.133Z a080d4da-a90f-4049-bbd5-f20f91e0df99
INFO PostmarkError: timeout of 180000ms exceeded
at ErrorHandler.buildGeneralError (/var/task/ui/node_modules/postmark/dist/client/ErrorHandler.js:39:16)
at ErrorHandler.buildRequestError (/var/task/ui/node_modules/postmark/dist/client/ErrorHandler.js:25:25)
at /var/task/ui/node_modules/postmark/dist/client/BaseClient.js:105:38
at processTicksAndRejections (internal/process/task_queues.js:95:5)
{ statusCode: 0, code: 0 } 2022-07-20T17:59:11.134Z a080d4da-a90f-4049-bbd5-f20f91e0df99
ERROR Unhandled Promise Rejection
{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"PostmarkError: timeout of 180000ms exceeded","reason":
{"errorType":"PostmarkError","errorMessage":"timeout of 180000ms exceeded","code":0,"statusCode":0,"name":"PostmarkError",
"stack":["PostmarkError: timeout of 180000ms exceeded","
at ErrorHandler.buildGeneralError (/var/task/ui/node_modules/postmark/dist/client/ErrorHandler.js:39:16)","
at ErrorHandler.buildRequestError (/var/task/ui/node_modules/postmark/dist/client/ErrorHandler.js:25:25)","
at /var/task/ui/node_modules/postmark/dist/client/BaseClient.js:105:38","
at processTicksAndRejections (internal/process/task_queues.js:95:5)"]},"promise":{},
"stack":["Runtime.UnhandledPromiseRejection: PostmarkError: timeout of 180000ms exceeded","
at process.<anonymous> (/var/runtime/index.js:35:15)","
at process.emit (events.js:412:35)","
at processPromiseRejections (internal/process/promises.js:245:33)","
at processTicksAndRejections (internal/process/task_queues.js:96:32)"]}
[ERROR] [1658339951135] LAMBDA_RUNTIME Failed to post handler success response. Http response code: 400.
END RequestId: 20cbab85-1282-4220-93da-599dcf2aba3a
REPORT RequestId: 20cbab85-1282-4220-93da-599dcf2aba3a
Duration: 17.40 ms Billed Duration: 18 ms Memory Size: 1024 MB
Max Memory Used: 306 MB RequestId: 20cbab85-1282-4220-93da-599dcf2aba3a
Error: Runtime exited with error: exit status 128 Runtime.ExitError 

Powersource avatar Jul 20 '22 18:07 Powersource

The code that does the sending https://github.com/cobudget/cobudget/blob/7e07ee91ffd67129462851fd49637e2841951601/ui/server/send-email.ts#L41-L48

We noticed this on magic link log-in emails so very low volume

Powersource avatar Jul 20 '22 18:07 Powersource

We're running 2.9.0, the newer releases seem to have different error handling so I guess I'll try updating.

Powersource avatar Jul 20 '22 18:07 Powersource

Hi @Powersource

are you still see this issue? We haven't received this type of timeout notifications from any other users, and haven't seen it before. Have you try to run the code in different environment, on different network?

It seems to be network related issue.

ibalosh avatar Aug 23 '22 10:08 ibalosh

Also I see you use pretty large batches there, of 500 emails, which can easily get to be pretty big email sends. We also recommend trying out smaller batches, of 100 emails for example. They will ease up the load on your network, and Postmark will also handle them easier.

Igor

ibalosh avatar Aug 23 '22 10:08 ibalosh