Posts

Showing posts with the label aws-lambda

AWS API Gateway only passing 1st variable to function, but lambda test passes all

AWS API Gateway only passing 1st variable to function, but lambda test passes all I'm finding this odd issue where AWS is passing the URL String parameters to a Lambda function properly but there is a break down in API gateway only when Lambda runs a Python handler function that calls KeywordSearch(keyword,page,RPP) that passes 3 variables to keywordSearch. In the lambda IDE test, it works without issue and prints out all 3 variables as seen in the logs as InsideKeywordSearch, Vars=: keyword: bombing page: 1 RPP: 10 But when I run an API Gateway test the log is showing the variable is not passed into the function as seen in the log showing no variable for RPP or Page. The keyword is passed only. Am I not defining the function correctly? it works in Lambda why not API gateway if this is so? here is a snippet of the code. Function Call def handler(event, context): print('Inside Handler Funciton') keyword = event.get('search_keyword', None) id = event.get('id...

How can run. Rails web app in AWS Lambda server

How can run. Rails web app in AWS Lambda server AWS (Amazon web service) introduced serverless computing commonly known as AWS Lamda, We can store the asset in S3 then deploy a lambda function to handle our business logic. Lamda will support ruby script. Is there any way to run a dynamic web framework like rails or Sinatra in Lambda server? 1 Answer 1 The main problem here is that AWS Lambda does not currently support Ruby. AWS Lambda supports code written in Node.js (JavaScript), Python, Java (Java 8 compatible), and C# (.NET Core) and Go However if you really want to run a rack (including Sinatra and Rails) based app it is possible, by bundling your own version of ruby in your deployment package. This blog post goes into detail about how to do that. Whether this is a good idea probably depends on what you are trying to achieve. By clicking "Post Y...

API Gateway + Lambda failed to handle exception

Image
API Gateway + Lambda failed to handle exception I have Python based Lambda which is integrated with API Gateway and try to handle lambda exception below. { "stackTrace": [ [ "/var/task/index.py", 14, "handler", "raise Exception(err)" ] ], "errorType": "Exception", "errorMessage": "device name existed" } I've defined HTTP status 400 of Method Response for the exception. I also defined "Lambda Error Regex" and "Body Mapping Templates". But the API Gateway still responses HTTP status 200 instead of 400 when my lambda raised an exception. Anyone has idea what's going wrong. Did I miss something? 1 Answer 1 I found the solution by myself. Here is my Lambda code: raise Exception({ "errorType" : "Exception", "httpS...