(aws-lambda-nodejs): ICommandHooks requires all hooks to be implementated
See original GitHub issueReproduction Steps
new lambda.NodejsFunction(this, "LambdaFunction", {
bundling: {
commandHooks: {
afterBundling(inputDir: string, outputDir: string): string[] {
return [`echo "hello world"`];
},
},
},
});
What did you expect to happen?
For this to be valid, and the equivalent of defining no commands for beforeBundling
and beforeInstall
.
What actually happened?
Type '{ afterBundling(inputDir: string, outputDir: string): string[]; }' is missing the following properties from type 'ICommandHooks': beforeBundling, beforeInstall
Environment
- CDK CLI Version : 1.91.0
- Framework Version: 1.91.0
- Node.js Version: v14.15.1
- OS : macOS Catalina
- Language (Version): Typescript (4.2.3)
Other
Happy to provide a pull-request for this, looks very easy to fix. Unless I’m missing something we can just declare the functions as optional and then default them to the equivalent of () => []
.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Amazon Lambda Node.js Library - AWS Documentation
The following hooks are available: beforeBundling : runs before all bundling commands. beforeInstall : runs before node modules installation.
Read more >[lambda-nodejs] Deploy additional files alongside bundled ...
I want to be able to push up some additional files along with the bundled output. One way of doing this would be...
Read more >@aws-cdk/aws-lambda-nodejs - npm
Start using @aws-cdk/aws-lambda-nodejs in your project by running `npm i ... to run additional commands by specifying the commandHooks prop:.
Read more >Project-level configurations - Command Hooks - Amplify Docs
Use Command Hooks to execute custom scripts before, during, and after Amplify CLI commands (“amplify push”, “amplify api gql-compile”, and more).
Read more >Webpack - Serverless Framework: Plugins
Integration of the lifecycles into the command invocations and hooks. The following list shows all lifecycles that are invoked/started by the plugin when ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Was able to figure out how to implement this in Python. The key step was creating an instance of the class and passing that into
BundlingOptions
@piotrekwitkowski FYI
A Python example how to use command_hooks would be greatly appreciated!