-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(APIGatewayv2.websocket: add support for HTTP integration #29562
(APIGatewayv2.websocket: add support for HTTP integration #29562
Comments
Associated documentation/API:
Current CDK implementation: Both |
@cloudshiftchris Thank you for the report. @nmussy Thank you for your PR! This is awesome! |
The PR I've opened doesn't address this specific issue, but will add properties that are also used by the HTTP integrations. I'll take care of them later if no one else takes them on 👍 |
### Issue # (if applicable) None as far as I can tell ### Reason for this change I was looking at the WebSocket integration to get a feel for #29562, and noticed a couple of missing properties ### Description of changes * Added support for `timeout` and `contentHandling` * Minor copy-pasta fixes in documentation and test description ### Description of how you validated changes I've added unit tests to check these optional properties. I've also updated and verified the following integrations tests: * `integ.lambda.ts`: * `ContentHandlingStrategy` and `TimeoutInMillis` are both correctly set ```sh $ aws apigatewayv2 get-integration --api-id bu24s9i8t0 --integration-id fxqec8c { "ConnectionType": "INTERNET", "ContentHandlingStrategy": "CONVERT_TO_TEXT", "IntegrationId": "fxqec8c", "IntegrationMethod": "POST", "IntegrationType": "AWS_PROXY", "IntegrationUri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:637423343434:function:WebSocketApiInteg-DefaultHandler604DF7AC-GSQYxsiaKjkz/invocations", "PassthroughBehavior": "WHEN_NO_MATCH", "PayloadFormatVersion": "1.0", "RequestTemplates": {}, "TimeoutInMillis": 10000 } ``` * `integ.aws.ts`: * `ContentHandlingStrategy`, `TemplateSelectionExpression`, `TimeoutInMillis`, `PassthroughBehavior`, and `RequestParameters` are all correctly set ```sh $ aws apigatewayv2 get-integration --api-id qp17tw07w3 --integration-id hycmjxb { "ConnectionType": "INTERNET", "ContentHandlingStrategy": "CONVERT_TO_BINARY", "CredentialsArn": "arn:aws:iam::637423343434:role/integ-aws-websocket-integrat-ApiGatewayRoleD2518903-i80lztfxo5XI", "IntegrationId": "hycmjxb", "IntegrationMethod": "POST", "IntegrationResponseSelectionExpression": "${integration.response.statuscode}", "IntegrationType": "AWS", "IntegrationUri": "arn:aws:apigateway:us-east-1:dynamodb:action/PutItem", "PassthroughBehavior": "WHEN_NO_TEMPLATES", "PayloadFormatVersion": "1.0", "RequestParameters": { "integration.request.header.Content-Type": "'application/x-www-form-urlencoded'" }, "RequestTemplates": { "application/json": "{\"TableName\":\"MyTable\",\"Item\":{\"id\":{\"S\":\"$context.requestId\"}}}" }, "TemplateSelectionExpression": "\\$default", "TimeoutInMillis": 10000 } ``` ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
### Issue # (if applicable) None as far as I can tell ### Reason for this change I was looking at the WebSocket integration to get a feel for aws#29562, and noticed a couple of missing properties ### Description of changes * Added support for `timeout` and `contentHandling` * Minor copy-pasta fixes in documentation and test description ### Description of how you validated changes I've added unit tests to check these optional properties. I've also updated and verified the following integrations tests: * `integ.lambda.ts`: * `ContentHandlingStrategy` and `TimeoutInMillis` are both correctly set ```sh $ aws apigatewayv2 get-integration --api-id bu24s9i8t0 --integration-id fxqec8c { "ConnectionType": "INTERNET", "ContentHandlingStrategy": "CONVERT_TO_TEXT", "IntegrationId": "fxqec8c", "IntegrationMethod": "POST", "IntegrationType": "AWS_PROXY", "IntegrationUri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:637423343434:function:WebSocketApiInteg-DefaultHandler604DF7AC-GSQYxsiaKjkz/invocations", "PassthroughBehavior": "WHEN_NO_MATCH", "PayloadFormatVersion": "1.0", "RequestTemplates": {}, "TimeoutInMillis": 10000 } ``` * `integ.aws.ts`: * `ContentHandlingStrategy`, `TemplateSelectionExpression`, `TimeoutInMillis`, `PassthroughBehavior`, and `RequestParameters` are all correctly set ```sh $ aws apigatewayv2 get-integration --api-id qp17tw07w3 --integration-id hycmjxb { "ConnectionType": "INTERNET", "ContentHandlingStrategy": "CONVERT_TO_BINARY", "CredentialsArn": "arn:aws:iam::637423343434:role/integ-aws-websocket-integrat-ApiGatewayRoleD2518903-i80lztfxo5XI", "IntegrationId": "hycmjxb", "IntegrationMethod": "POST", "IntegrationResponseSelectionExpression": "${integration.response.statuscode}", "IntegrationType": "AWS", "IntegrationUri": "arn:aws:apigateway:us-east-1:dynamodb:action/PutItem", "PassthroughBehavior": "WHEN_NO_TEMPLATES", "PayloadFormatVersion": "1.0", "RequestParameters": { "integration.request.header.Content-Type": "'application/x-www-form-urlencoded'" }, "RequestTemplates": { "application/json": "{\"TableName\":\"MyTable\",\"Item\":{\"id\":{\"S\":\"$context.requestId\"}}}" }, "TemplateSelectionExpression": "\\$default", "TimeoutInMillis": 10000 } ``` ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Progress report: I got things mostly figured out for the HTTP integrations. One thing I did notice was the lack of proper support for |
Just +1ing this issue. Thanks for the work on this. |
Watching - this would be a huge help for me. |
Has anyone managed to achieve this even with an L1 construct? We're looking to do an http integration at my work as well. |
+1 as well. This is a pretty significant gap in CDK feature parity. |
Describe the feature
Presently the
WebSocketApi
construct supports lambda, AWS and Mock integrations; add support for HTTP integration; effectively all available options in the GUI/CFN for this (proxy, vpc link, etc).Use Case
Websocket messages being delivered to internal HTTP endpoints.
Proposed Solution
Add a new WebSocketHttpIntegration implementation of WebSocketIntegration
Other Information
No response
Acknowledgements
CDK version used
2.132.0
Environment details (OS name and version, etc.)
MacOS
The text was updated successfully, but these errors were encountered: