streambot
streambot copied to clipboard
If aws-sdk is a dependency, lambda errors
I hit an odd bug when setting up a streambot lib that requires the aws-sdk for kms, but if aws-sdk
is declared in the package.json
I get a Cannot find module 'xmlbuilder'
error bubbling up from the aws-sdk
. This occurs even after investigating the bundle.zip
and finding that aws-sdk
with the xmlbuilder
module is installed correctly.
If aws-sdk
is removed from package.json
, aws-sdk
still is installed into the node_modules folder in bundle.zip
because of https://github.com/mapbox/streambot/blob/master/bin/bundle#L24. I still see an error in the lambda logs, but it's changed to something like cannot find index
(actual log has been lost. Seems that when you change the event source it clears the logs -- logs are stored by shardId and it looks like previous logs were overwritten).
If I make sure that there is no aws-sdk
installed in bundle.zip
, everything works fine.
Maybe this has something to do with:
the current version of the AWS SDK is pre-installed in Lambda
and bad interactions between versions? Perhaps this case only occurs when deploying a lambda function that requires aws-sdk
directly.
cc @mick @rclark