2

AWS SDK for node.js can not be run through browserify due to how the SDK is loaded

I want to included a newer version of the AWS SDK for node then what is included in lambda but I also want to optimize (via browserify) my lambda node.js code.

How do I pull this off?

1 Answer 1

2

The JAWS AWS Module system (aka awsm) allows for this functionality via an attribute in the awsm.json metadata file that specifies how the lambda code is packaged.

Specifically the lambda.package.optimize.exclude and lambda.package.optimize.includePaths defined in the lambda configuration options section of the awsm.json spec.

The exclude attribute specifies node modules that should be excluded from the optimization process (under the covers it is just using browserify exclude). In the exclude attribute you simply specify ['aws-sdk']. You must then tell JAWS to include aws-sdk in the zip by putting its path in includePaths.

The includePaths attribute is a list of paths relative to the back directory that are pulled in as-is into the zip file before deployment.

For a complete example see the awsm sample

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.