Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon AWS Lambda: Cannot find "Request"

I'm using the AWS Lambda Function in the Amazon AWS Online-Builder. I'm using nodejs 6.10. and I want to require the reuest module with var test = require("request"). But the response is: "errorMessage": "Cannot find module 'request'", I'm also including the module http with var http = require('http'); and this works. Anyone an idea, why I cannot require "request"? THANKS!

like image 611
Zwen2012 Avatar asked Feb 27 '18 10:02

Zwen2012


People also ask

How do I troubleshoot AWS Lambda?

To troubleshoot Lambda code errors You can use CloudWatch to view all logs generated by your function's code and identify potential issues. For more information, see Accessing Amazon CloudWatch Logs for AWS Lambda.

How many requests Lambda can handle?

The default concurrency limit per AWS Region is 1,000 invocations at any given time. The default burst concurrency quota per Region is between 500 and 3,000, which varies per Region. There is no maximum concurrency limit for Lambda functions.

What is a Lambda request?

Q: What is AWS Lambda? AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume - there is no charge when your code is not running. With Lambda, you can run code for virtually any type of application or backend service - all with zero administration.


1 Answers

You need to have add a dependency for the request module in your package.json file. Something like:

"dependencies": { "request": "2.88.0" }

There is a good description of how to add node modules to a function at https://github.com/serverless/serverless/issues/948

like image 193
Lester Thomas Avatar answered Oct 29 '22 02:10

Lester Thomas