Tuesday, 14 November 2023

Request must be smaller for InvokeFunction

I have a lambda function that works as expected when my input is 2 or 3 words. But if I have 2 or 3 paragraphs, I get an error.

# wc t.txt 
# returns 5  320 4867 t.txt 

There are less than 5 thousand bytes and I get this error from Lambda Function URI

{"Message":"Request must be smaller than 6291456 bytes for the InvokeFunction operation"}

The text is certainly smaller than 6 million bytes. I do not see any reason why should I get this error.


Update:

As per the docs "The maximum size for a Lambda event payload is 256 KB." But the text that I tried is a lot smaller than that.

In order to reproduce my issue, copy paste the URL in browser.

https://qcct6oyi3jtfxdgf4dssguux3q0ocqvt.lambda-url.us-east-1.on.aws/?

Copy-paste the text next to question mark shown above. You will get the expected results.

मग  त्यानेच  सांगितलं  की  गावामध्ये  एक  अपराधी  लोकांना  त्रास  देत  सुटला  आहे  लोकांना  पळवणं  आणि  गायब  करणं  सुरू  झालं  आहे  आणि  अपराधी  इतका  तयारीचा  आहे  की  लोकांना  जाणीवही  नाही  अजून  की  असं  काही  घडलंय    त्याने  मग  आमच्या  दूरच्या  मित्रांच्या  संदर्भात  माहिती  दिली  की  त्यांच्यासोबत  काय  घडलंय  ते  ऐकून  धक्का  बसला  मग  मीच  त्याला  बोललो  की  हे  तू  पोलिसांना  का  सांगितलं  नाही  इथे  का  सांगतोय  त्यावर  तो  म्हणाला    शत्रू  खूपच  खतरनाक  आहे  इतका  की    त्याच्याही  जीवाला  धोका  आहे  त्यामुळे  अगदी  जपून  आणि  सगळी  काळजी  घेऊन  आपल्याला  काम  केलं  पाहिजे  मग  मी  त्याला  विचारलं  की  हे  तुला  कसं  कळालं  तो  म्हणाला  की    एका  बेकरीमध्ये  जाताना  त्याला  एका  व्हॅनमधलं  ओरडणं  ऐकून  शंका  आली  आणि  ज्याला  गायब  केलं  होतं  त्याचा  मित्र  जितेशला  त्या  दिवशी  भेटला  त्यामुळे  त्याला  कळालं  की  असं  काही  होतं  आहे  आणि  मग  त्याने  अजून  पुढचे  तपशील  सांगितले  ते  ऐकताना  भितीही  वाटत  होती  आणि  काळजीही  वाटत  होती    त्यानेच  सांगितलं  की  गावामध्ये  एक  अपराधी  लोकांना  त्रास  देत  सुटला  आहे  लोकांना  पळवणं  आणि  गायब  करणं  सुरू  झालं  आहे  आणि  अपराधी  इतका  तयारीचा  आहे  की  लोकांना  जाणीवही  नाही  अजून  की  असं  काही  घडलंय    त्याने  मग  आमच्या  दूरच्या  मित्रांच्या  संदर्भात  माहिती  दिली  की  त्यांच्यासोबत  काय  घडलंय  ते  ऐकून  धक्का  बसला  मग  मीच  त्याला  बोललो  की  हे  तू  पोलिसांना  का  सांगितलं  नाही  इथे  का  सांगतोय  त्यावर  तो  म्हणाला    शत्रू  खूपच  खतरनाक  आहे  इतका  की    त्याच्याही  जीवाला  धोका  आहे  त्यामुळे  अगदी  जपून  आणि  सगळी  काळजी  घेऊन  

Now add this line at the end of the text mentioned above.

आपल्याला  काम  केलं  पाहिजे  मग  मी  त्याला  विचारलं  की  हे  तुला  कसं  कळालं  तो  म्हणाला  की    एका  बेकरीमध्ये 

And you will get an error:

{"Message":"Request must be smaller than 6291456 bytes for the InvokeFunction operation"}

The text is smaller than 256 KB limit.


Update 2:

The r.content is empty. But the expected result is:

[{"गावाम": "गावा गमावा वावगा"}]

How do i write post request in python?

import requests
myurl = 'https://qcct6oyi3jtfxdgf4dssguux3q0ocqvt.lambda-url.us-east-1.on.aws/?'
r = requests.post(myurl, data='गावाम'.encode('utf-8'))


from Request must be smaller for InvokeFunction

No comments:

Post a Comment