question

john avatar image
john asked

restler libary not avaliable in Lambda

Hi All, I have built a sample skill, which has some Lambda function with node.js environment.The code works fine if i execute my .js file in node.js However if i use require('restler') in AWS Lambda edit code environment, I get the error "Exception: Error: Cannot find module 'restler'". Does lambda has restler library if not is there any alternative ? Thanks, John
alexa skills kitsubmission testing certification
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Galactoise avatar image
Galactoise answered
At least with Java code, Lambda provides a way that you can package libraries with your own code so they're available on your function's classpath. I haven't done much with Node, but I'd expect there is a similar mechanism.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

memo@amazon avatar image
memo@amazon answered
Hi john, You [b]need[/b] to include node module(s) with the rest of your js source code when you upload it. You can find instructions for loading and testing a module on AWS ( to make sure it'll play nice with lambda) here: https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/ I've done some testing with [b]restler[/b] and it worked fine for me (your mileage may vary, etc.) just uploading the module that I installed using npm on my Mac.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

john avatar image
john answered
Thanks for the information, it was really helpful.I shall try out and update.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

john avatar image
john answered
I tried with the suggested method. It works. Great Thanks!!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Levon@Amazon avatar image
Levon@Amazon answered
Thanks for the confirmation John, we are glad it worked for you.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.