aws / aws/aws-cdk

(custom-resources): provider-framework export request/response types for OnEventHandler and IsComplete Handler

Open
#22,702 5 comments 8 reactions 0 assignees View on GitHub
@aws-cdk/custom-resources effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

While leveraging the powerful `provider-framework` one needs the proper Event and Response types.

The single point of truth is here: https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/custom-resources/lib/provider-framework/types.d.ts#L53

Often People try to use `import { CloudFormationCustomResourceEvent, CloudFormationCustomResourceDeleteEvent, CloudFormationCustomResourceUpdateEvent, CloudFormationCustomResourceCreateEvent } from "aws-lambda";` (which leads to a different understanding) or https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/aws-lambda/trigger/cdk-custom-resource.d.ts (which are outdated and have other names)

How can we export them as a lighweight package from aws-cdk-lib to import in a Lambda?

### Use Case

I'm always frustrated when looking for the correct and up-to-date typings for a lambda handler

### Proposed Solution

Publish the OnEvent and IsComplete Handler types as a package from sources

### Other Information

Using the CFN CustomResource types lead to a different of the provider-framework

### Acknowledgements

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.48.0

### Environment details (OS name and version, etc.)

MacOS

Contributor guide

Open the contributing guide

Research direction

Start with packages/@aws-cdk/custom-resources/lib/provider-framework/types.d.ts, especially the definitions for the OnEventHandler and IsComplete Handler event and response types. Trace how the custom-resources package is published and exported, then verify that consumers can import the current provider-framework types without using the aws-lambda typings.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cloud, developer-experience
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.