![]() ![]() Then create a zip package but don’t include the node_modules folder. This file you will need for AWS CodeBuild. In case somebody is still struggling and the command does not work, there is also another solution, which worked well for me.īuild up the node.js project, ad your package.json with your dependencies and add a buildspec.yml file to your project with following content: version: 0.2 Has anyone had this situation before, and if so what did you do? Unfortunately I don’t see a way to run npm rebuild or even npm install directly on the Lambda machine. The post-install scripts ran successfully on my machine but I’m concerned that this isn’t representative of the machine my Lambda function is running on. The same error appears for the other plugins depending on which is POSTed to the endpoint.įrom reading other issues on this repo and the repos for the respective plugins, it seems this issue might relate to the post-install script that is run after npm install for each plugin. When sending images for compression to the deployed URL (which passes onto the Lambda function), the following errors appear in my CloudWatch logs: T16:38:28.121Zđ58daaf2-c8bd-11e8-bfb3-3d6074a8db11 (node:1) UnhandledPromiseRejectionWarning: Error: spawn /var/task/node_modules/optipng-bin/vendor/optipng ENOENTĪt Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)Īt onErrorNT (internal/child_process.js:372:16)Īt _combinedTickCallback (internal/process/next_tick.js:138:11)Īt process._tickDomainCallback (internal/process/next_tick.js:218:9) I have since tested all other aspects of the Lambda and the AWS API Gateway and they are functioning well. To deploy to AWS Lambda, first I ran npm install locally, then compress the entire project (including node_modules) in a. It compresses images and sends them back to the client. This API works correctly when host locally. I’ve built a simple express api that minifies images using imagemin with the following plugins: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |