I've deployed my lambda to AWS (NodeJS runtime).
I am using axios to do a post request with formdata to the URL:
https://autopaypm.com/rate.php
In my case:
- Locally it works correctly
- However, when running my code in the deployed Lambda it returns error 503
Error log of lambda shows the following:
2022-12-19T15:27:22.607Z 46cb1f4a-48b4-47c5-ab29-fb930e51a397 INFO AxiosError: Request failed with status code 503
at settle (/var/task/node_modules/axios/dist/node/axios.cjs:1855:12)
at IncomingMessage.handleStreamEnd (/var/task/node_modules/axios/dist/node/axios.cjs:2712:11)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 'ERR_BAD_RESPONSE',
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 5000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: null },
validateStatus: [Function: validateStatus],
headers: AxiosHeaders {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'multipart/form-data; boundary=--------------------------059092898205449353940589',
'Accept-Encoding': 'gzip,deflate,compress',
'User-Agent': 'axios 1.2.1'
},
method: 'post',
url: 'https://autopaypm.com/rate.php',
data: FormData {
_overheadLength: 755,
_valueLength: 35,
_valuesToMeasure: [],
writable: false,
readable: true,
dataSize: 0,
maxDataSize: 2097152,
pauseStreams: true,
_released: true,
_streams: [],
_currentStream: null,
_insideLoop: false,
_pendingNext: false,
_boundary: '--------------------------059092898205449353940589',
_events: [Object: null prototype],
_eventsCount: 3
}
},
request: ClientRequest {
_events: [Object: null prototype] {
socket: [Function],
abort: [Function],
aborted: [Function],
connect: [Function],
error: [Function],
timeout: [Function],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: true,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'autopaypm.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'autopaypm.com',
_readableState: [ReadableState],
readable: true,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
timeout: 5000,
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 537,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 5000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 26956,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 545,
[Symbol(triggerId)]: 540
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
connection: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'autopaypm.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'autopaypm.com',
_readableState: [ReadableState],
readable: true,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
timeout: 5000,
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 537,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 5000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 26956,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 545,
[Symbol(triggerId)]: 540
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
_header: 'POST /rate.php HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: multipart/form-data; boundary=--------------------------059092898205449353940589\r\n' +
'Accept-Encoding: gzip,deflate,compress\r\n' +
'User-Agent: axios 1.2.1\r\n' +
'Host: autopaypm.com\r\n' +
'Connection: close\r\n' +
'Transfer-Encoding: chunked\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxTotalSockets: Infinity,
totalSocketCount: 1,
scheduling: 'fifo',
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'POST',
insecureHTTPParser: undefined,
path: '/rate.php',
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
readable: false,
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
socket: [TLSSocket],
connection: [TLSSocket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 503,
statusMessage: 'Service Temporarily Unavailable',
client: [TLSSocket],
_consuming: true,
_dumped: false,
req: [Circular],
responseUrl: 'https://autopaypm.com/rate.php',
redirects: [],
[Symbol(kCapture)]: false
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'autopaypm.com',
protocol: 'https:',
_redirectable: Writable {
_writableState: [WritableState],
writable: true,
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 846,
_requestBodyBuffers: [],
_onNativeResponse: [Function],
_currentRequest: [Circular],
_currentUrl: 'https://autopaypm.com/rate.php',
_timeout: null,
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'content-type': [Array],
'accept-encoding': [Array],
'user-agent': [Array],
host: [Array]
}
},
response: {
status: 503,
statusText: 'Service Temporarily Unavailable',
headers: AxiosHeaders {
date: 'Mon, 19 Dec 2022 15:27:22 GMT',
'content-type': 'text/html; charset=UTF-8',
'transfer-encoding': 'chunked',
connection: 'close',
'cross-origin-embedder-policy': 'require-corp',
'cross-origin-opener-policy': 'same-origin',
'cross-origin-resource-policy': 'same-origin',
'permissions-policy': 'accelerometer=(),autoplay=(),camera=(),clipboard-read=(),clipboard-write=(),fullscreen=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()',
'referrer-policy': 'same-origin',
'x-frame-options': 'SAMEORIGIN',
'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
expires: 'Thu, 01 Jan 1970 00:00:01 GMT',
'server-timing': 'cf-q-config;dur=6.0000020312145e-06',
'report-to': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=GIp512epRW9w2zVQIe7I1QuC0oML60qhkbrRUAbf9G0x3HePioEXWk5gcnv7rXloQF4vCPSJSWRaQ9dCCvI59HOKYI9Lo%2BMkcgnpRhkp1rgAk3aeQAdh4dyR7gBokKBD"}],"group":"cf-nel","max_age":604800}',
nel: '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}',
vary: 'Accept-Encoding',
server: 'cloudflare',
'cf-ray': '77c129763b883095-SEA',
'alt-svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400'
},
config: {
transitional: [Object],
adapter: [Array],
transformRequest: [Array],
transformResponse: [Array],
timeout: 5000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: [Object],
validateStatus: [Function: validateStatus],
headers: [AxiosHeaders],
method: 'post',
url: 'https://autopaypm.com/rate.php',
data: [FormData]
},
request: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: true,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
connection: [TLSSocket],
_header: 'POST /rate.php HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: multipart/form-data; boundary=--------------------------059092898205449353940589\r\n' +
'Accept-Encoding: gzip,deflate,compress\r\n' +
'User-Agent: axios 1.2.1\r\n' +
'Host: autopaypm.com\r\n' +
'Connection: close\r\n' +
'Transfer-Encoding: chunked\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'POST',
insecureHTTPParser: undefined,
path: '/rate.php',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'autopaypm.com',
protocol: 'https:',
_redirectable: [Writable],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
data: '<!DOCTYPE html>\n' +
'<html lang="en-US">\n' +
'<head>\n' +
' <title>Just a moment...</title>\n' +
' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n' +
' <meta http-equiv="X-UA-Compatible" content="IE=Edge">\n' +
' <meta name="robots" content="noindex,nofollow">\n' +
' <meta name="viewport" content="width=device-width,initial-scale=1">\n' +
' <link href="/cdn-cgi/styles/challenges.css" rel="stylesheet">\n' +
' <meta http-equiv="refresh" content="35">\n' +
'\n' +
'</head>\n' +
'<body class="no-js">\n' +
' <div class="main-wrapper" role="main">\n' +
' <div class="main-content">\n' +
' <h1 class="zone-name-title h1">\n' +
' <img class="heading-favicon" src="/favicon.ico"\n' +
' onerror="this.onerror=null;this.parentNode.removeChild(this)">\n' +
' autopaypm.com\n' +
' </h1>\n' +
' <h2 class="h2" id="challenge-running">\n' +
' Checking if the site connection is secure\n' +
' </h2>\n' +
' <noscript>\n' +
' <div id="challenge-error-title">\n' +
' <div class="h2">\n' +
' <span class="icon-wrapper">\n' +
' <div class="heading-icon warning-icon"></div>\n' +
' </span>\n' +
' <span id="challenge-error-text">\n' +
' Enable JavaScript and cookies to continue\n' +
' </span>\n' +
' </div>\n' +
' </div>\n' +
' </noscript>\n' +
` <div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/jsch/nojs/transparent.gif?ray=77c129763b883095')"></div>\n` +
' <div id="challenge-body-text" class="core-msg spacer">\n' +
' autopaypm.com needs to review the security of your connection before proceeding.\n' +
' </div>\n' +
' <form id="challenge-form" action="/rate.php?__cf_chl_f_tk=t6fpv0vGtE4mAJk9GQLU8TbtWiwHSQFEuG6Gdzm8S1E-1671463642-0-gaNycGzNCf0" method="POST" enctype="application/x-www-form-urlencoded">\n' +
' <input type="hidden" name="md" value="rtPyyR93tNOMbqayhVxMKQziEDt8BhzPwKTTe2N6PF4-1671463642-0-AQ9mVpD3FlIMSiyOtauRl7MdIVC1-g6Ol1kP4vVFxGsL43dBjFrBdaKeHrNnqYvajrweVvweo7oKEVpp6LSjUdGSboW84LVcdZfBx0BYOKk__yeRK5447LRnJFR7PGw4A_uS0ckfhIrPPjtZfJOsP9sKnbpnA2K4YR9Wma9rLhgzR2_WBI3IPUzJ0eqVxWxLILMThnYRrOKCGBlN5kTlSlFik445OOpBhqKGyounxeFsWSywmPQl417KkAKuuR3pWeQOOCqbAL7I7xgSWd9ETar59mF0PXh3JquhwwN-YGoJsN6MbQkLo-6XdSuBq_fOdfZdW6yrUEEqQQavmPz5Ge3Ix1cpl5e1f1U4i5ALPp5IatpYlgUX0ZR4vNMLEm_pKExAnh3TCgHoJWzsOoGUrHlJleetQe2NZ3Bgy55XvAMCOQq6YYhCRk7Rj2QVl3fOxHi3scu2_cODUFE2wO2QfHnhZlygxbZH5oubErnrpaZfancl57Vtg1vFfyNi7lPJQENsDSmTGIIxkbd9dbc0xJ9LV-m34m1V85T_ASxymzHe">\n' +
' <input type="hidden" name="r" value="Y2B4YUjgtSCNRcY4iKN81fkH6kWzqbwqhunIoz9pSzQ-1671463642-0-AWJ8M9Ef253jR/o5BfhE+RDoi8XunOqdHoFUphzvmdP9PPQhhVD4CxIE22oM9joZJRAE8qJD6KkMAX6nBRFv1UJWL2Utf7g+KbV5WBT2TuWTBFytxAMUuoRcoayJvmyTtPGKibaYhefquQ8I0ROPgJ5Dlz06s03zB+7mHr3Ask6PA6L3dLV2pZUDvFHMDsp/SFoXqUteSrW00VkTK99LG+RpAEO+JWDTjsjSlmyOfYTWXin6aJGa87lSzwXblAhIsCkZiRnaaJFBbFMka37cSlwvWZmd4VrwUqAR4OsNX9zCpO2I+soBMDicn8UgkEE2boou64owd7Yqe8CYRipULr0uHVw3yU2+maQeCDZj9GtK72fYhr1P24QekUIG/XdB21RSTweOBSJocBWKQnr0rIrO/pxWEq9M+Y5gtT5MJYUwKL5co8CafA45QOlWa9LFEf0OQqbqyWTJqHYp6CIJzwFOHgFZnX+M84F2Zdh4Sc6orrbkPwM2gTFzU2Sn9uD4xa754ISbOuX5a+1eaNW2XXkEcFj7MNF0dtRvf2UIwW+JDIfCF2C/pJFm5BkptYQLwC5msukjFQ/7IFIijRbze5L9DuZTAwf5bUOGBm4IlDRpMSVA74nz8uindTOJv5R3eL//OA8rlt2gciTHfhvWJB1pQxe+LUawMTugDzKytWqtxxZ+sGu7+scKxmwBqCwBJGTfosywJ9zdXxl +
' </form>\n' +
' </div>\n' +
'</div>\n' +
'<script>\n' +
' (function(){\n' +
' window._cf_chl_opt={\n' +
" cvId: '2',\n" +
" cType: 'non-interactive',\n" +
" cNounce: '33598',\n" +
" cRay: '77c129763b883095',\n" +
" cHash: 'a375c0faec69836',\n" +
' cUPMDTk: "\\/rate.php?__cf_chl_tk=t6fpv0vGtE4mAJk9GQLU8TbtWiwHSQFEuG6Gdzm8S1E-1671463642-0-gaNycGzNCf0",\n' +
"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ujtHWn6Gz34qQOcUeMwE+vQ6kDfOOHVs=',\n" +
' }\n' +
' };\n' +
" var trkjs = document.createElement('img');\n" +
" trkjs.setAttribute('src', '/cdn-cgi/images/trace/jsch/js/transparent.gif?ray=77c129763b883095');\n" +
" trkjs.setAttribute('style', 'display: none');\n" +
' document.body.appendChild(trkjs);\n' +
" var cpo = document.createElement('script');\n" +
" cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/jsch/v1?ray=77c129763b883095';\n" +
" window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;\n" +
" window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, -window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;\n" +
' if (window.history && window.history.replaceState) {\n' +
' var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;\n' +
' history.replaceState(null, null, "\\/rate.php?__cf_chl_rt_tk=t6fpv0vGtE4mAJk9GQLU8TbtWiwHSQFEuG6Gdzm8S1E-1671463642-0-gaNycGzNCf0" + window._cf_chl_opt.cOgUHash);\n' +
' cpo.onload = function() {\n' +
' history.replaceState(null, null, ogU);\n' +
' };\n' +
' }\n' +
" document.getElementsByTagName('head')[0].appendChild(cpo);\n" +
' }());\n' +
'</script>\n' +
'\n' +
'\n' +
' <div class="footer" role="contentinfo">\n' +
' <div class="footer-inner">\n' +
' <div class="clearfix diagnostic-wrapper">\n' +
' <div class="ray-id">Ray ID: <code>77c129763b883095</code></div>\n' +
' </div>\n' +
' <div class="text-center">Performance & security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=j" target="_blank">Cloudflare</a></div>\n' +
' </div>\n' +
' </div>\n' +
'</body>\n' +
'</html>\n'
}
}
`
Do we have any soltution for that? It come from the target site or from the lambda? Thank you so much