We are trying to invoke a Lambda function from a node.js API proxy. The test seems to fail with a aws-sdk module not found error. The code is similar to this -
var AWS = require('aws-sdk');
...AWS access key info...
var lambda = new AWS.Lambda();
The exact error is -
{"fault":{"faultstring":"Script node executed prematurely: Error: Cannot find module 'aws-sdk'\nError: Cannot find module 'aws-sdk'\n at module.js:340\n at module.js:280\n at module.js:364\n at require (module.js:380)\n at \/organization\/environment\/api\/hello-world.js:6\n at module.js:456\n at module.js:474\n at module.js:356\n at module.js:312\n at module.js:497\n at startup (trireme.js:142)\n at trireme.js:923\n","detail":{"errorcode":"scripts.node.runtime.ScriptExitedError"}}}
We have tried using the Resource API to upload a zip of the aws-sdk node module without any success -(https://docs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/apis/%7Bapi_name%7D/revisions/%7Brevision_number%7D)
Any help will be greatly appreciated.
TIA
,We are trying to invoke an AWS Lambda function (simple Hello World python code) from an Apigee Node.js proxy. The hello-world.js node code in Apigee looks something like this -
var AWS = require('aws-sdk');
...code for accesskey, etc.
lambda = new AWS.Lambda();
...code to invoke Lambda
On testing this we keep getting an error that aws-sdk module could not be found -
{"fault":{"faultstring":"Script node executed prematurely: Error: Cannot find module 'aws-sdk'\nError: Cannot find module 'aws-sdk'\n at module.js:340\n at module.js:280\n at module.js:364\n at require (module.js:380)\n at \/organization\/environment\/api\/hello-world.js:6\n at module.js:456\n at module.js:474\n at module.js:356\n at module.js:312\n at module.js:497\n at startup (trireme.js:142)\n at trireme.js:923\n","detail":{"errorcode":"scripts.node.runtime.ScriptExitedError"}}}
We have tried uploading a zip file containing the aws-sdk node module using the Resource API here -
We can see the uploaded zip files as well. However, this doesn't seem to resolve the problem of not able to find aws-sdk module.
Any ideas on what else we can try?
TIA