How to attach files to a lambda function?

Hi All,

I’m creating a function on Lambda in JavaScript (node.js) that is supposed to work with mp3 file downloaded from S3 bucket.
JS function has as a dependency lambda-audio lib which is a JS wrapper on lame and sox (linux) binaries used to manipulate mp3 file.

While using serverless to deploy my function both files (lame and sox) are omitted and available during runtime, thus generating error. lambda-audio author is using Claudia.js to upload functions to Lamdba and says that it works with it.

I have used in my serverless.yml:

    - node_modules/lambda-audio/bin/lame
    - node_modules/lambda-audio/bin/sox

to include those files but generated zip in .serverless directory doesn’t include those files.

I also use severeless-webpack plugin (which I plan to remove since Node 8.10 is supported now), which can interfere witch package building.

I’m not sure, so could anyone tell me whether those binary files (lame and sox) should be automatically included in a zip file uploaded to lambda or I should manually include them? If so, how to do it?

thanks in advance :slight_smile:

Ok, I did a test without severeless-webpack plugin and it creates a zip files with node_modules inside. Those binary lame and sox files are present. So the plugin is the problem here.

Any idea how to fix that problem?

If you are using serverless-webpack you can use copy-webpack-plugin to include additional files in the package.