If you got the following error when run the sam deploy :
CREATE_FAILED AWS::Lambda::Function <YourFunctionName> Resource handler Function returned message: "Uploaded file must be a non-empty zip (Service: Lambda, Status Code: 400, Request ID: <YourRequestID>, Extended Request ID: null)" (RequestToken: <YourRequestToken>, HandlerErrorCode: InvalidRequest)
First of all, check your lambda function resource path in the template.yaml file, make sure you have the correct path, and it did have the specified source code file under the folder.
Otherwise, it might be the node version issue, the CDK bug is #12536 and the upstream NodeJS bug is #37027.
Try to change the node version to older than v15.5.0 to mitigate this issue:
nvm list nvm use <Older Version>
Similar Posts:
- [Node.js] fs.renameSync() Error: Error: ENOENT: no such file or directory, rename…
- Local workspace file (‘angular.json’) could not be found.
- XHR request status is the solution to failed
- [Solved] Error reporting of NPM packaged electron app
- Failed to install node with. MSI, rolling back action (Reprint)
- NPM Install vue-cli Error: internal/modules/cjs/loader.js (Error: Cannot find module ‘D:\Program\nodejs\node_global\node_modules\vue-cli\bin\vue’)
- [Solved] Nodejs Error: Cannot find module ‘express’
- Error: exec npm config get prefix ERROR: Command failed: npm config get prefix [How to Solve]
- [Solved] Error:Node Sass version 6.0.0 is incompatible with ^4.0.0
- Solution to the problem of bash: gulp: command not found after installing gulp in Windows system