Lambda with ALB doing https call cold start issue?

Viewed 18

I have a lambda which I'm using with an ALB. It processes some things, then does an https call to a vendor and they send a request back.

One big issue I'm running into and it seems to occur at a few random times is with this code:

s = requests.Session()
s.headers.update({'Content-Type': 'application/json'})
result = s.post(urljoin(baseurlcall, make_uri), data=json.dumps(somepayload), timeout=5)
result.status_code
print ('*** <-- Site response: ' + result.text)

Sometimes, when the lambda gets executed it seems to cause a 502 response on the front-end. I use postman. Sometimes when I click the same thing, it will respond with a 200? Is this a lambda cold start issue? Anything I can do to catch exceptions better with external calls in a lambda?

0 Answers
Related