Reputation: 6800
I am uploading the zip file which contains all the python files and dependencies to the AWS Lambda, and it's working perfectly without any error.
However the Edit code inline
function is not working. I have to upload the whole zip file again and again whenever I am making any changes. And it is happening just for this Lambda function. Inline editor in other functions are working file.
Am I missing something?
Upvotes: 2
Views: 6369
Reputation: 778
Few things to make the size of package small and being able to view the code online:
So following these 2 steps I am able to view the code in the code tab. Also this makes the lambda light weight and package size small.
Example:
def send_request(method, url, payload = {}):
import urllib3
http = urllib3.PoolManager()
response = http.request(method, url, fields=payload)
status_code = response.status
content = response.data.decode('utf-8')
data = json.loads(content)
return data, status_code
Use:
data, status_code = send_request("GET", "https://jsonplaceholder.typicode.com/posts/1")
print(data, status_code)
Upvotes: 0
Reputation: 3473
This typically indicates the uploaded Lambda (zip file) exceeds the max allowable size for AWS to display the inline code editor. The limit currently is 3 MB as far as zipped lambda import.
It will still work, but you cannot use/view the inline code editor.
If you are using aws-sdk you can omit this from included libs as it is made available by default and does take up a lot of space.
You might want to consider changing your lambda dev workflow, utilizing something like lambda-toolkit (or just AWS CLI) to create/edit/test locally and then push to AWS for deployment only.
Upvotes: 1
Reputation: 43
It is due to the size of your function.
If you try to reduce the size of the function then it will show up in online code editor.
It is good practice to use base packages instead of custom libraries in aws-lambda.
Upvotes: 3