AWS CDK API Gateway V2 Integrations (Alpha)
raw JSON → 2.114.1a0 verified Fri May 01 auth: no python deprecated
Deprecated alpha module for AWS CDK API Gateway V2 integrations (WebSocket & HTTP APIs). Replaced by aws-cdk-lib/aws-apigatewayv2-integrations since CDK v2. Last published version is 2.114.1a0. Release cadence: weekly.
pip install aws-cdk-aws-apigatewayv2-integrations-alpha Common errors
error ModuleNotFoundError: No module named 'aws_cdk.aws_apigatewayv2_integrations_alpha' ↓
cause The alpha package is not installed or you are using the wrong import path.
fix
Run 'pip install aws-cdk-aws-apigatewayv2-integrations-alpha' OR switch to stable import: from aws_cdk.aws_apigatewayv2_integrations import ...
error ImportError: cannot import name 'HttpLambdaIntegration' from 'aws_cdk.aws_apigatewayv2_integrations_alpha' ↓
cause The class name may differ between alpha and stable, or the alpha version is outdated.
fix
Use stable CDK: from aws_cdk.aws_apigatewayv2_integrations import HttpLambdaIntegration
error jsii.errors.JSIIError: There is already a ... construct with name '...' ↓
cause Mixing alpha and stable constructs for the same API resource.
fix
Use only stable constructs from aws-cdk-lib.
Warnings
deprecated This package is deprecated. All constructs are available in aws-cdk-lib as stable. Do not start new projects with alpha modules. ↓
fix Use aws-cdk-lib/aws-apigatewayv2-integrations instead.
breaking Alpha modules may have breaking changes without notice. They also have different import paths from stable modules. ↓
fix Migrate to stable aws-cdk-lib imports as soon as possible.
gotcha Installing the alpha package (e.g., aws-cdk-aws-apigatewayv2-integrations-alpha) alongside aws-cdk-lib can cause duplicate construct errors. ↓
fix Remove the alpha package and import from 'aws_cdk.aws_apigatewayv2_integrations'.
Imports
- HttpAlbIntegration wrong
from aws_cdk.aws_apigatewayv2_integrations_alpha import HttpAlbIntegrationcorrectfrom aws_cdk.aws_apigatewayv2_integrations import HttpAlbIntegration - WebSocketLambdaIntegration wrong
from aws_cdk.aws_apigatewayv2_integrations_alpha import WebSocketLambdaIntegrationcorrectfrom aws_cdk.aws_apigatewayv2_integrations import WebSocketLambdaIntegration
Quickstart
import aws_cdk as cdk
from aws_cdk.aws_apigatewayv2 import HttpApi
from aws_cdk.aws_apigatewayv2_integrations import HttpLambdaIntegration
app = cdk.App()
stack = cdk.Stack(app, 'MyStack')
# Define Lambda function (placeholder)
from aws_cdk.aws_lambda import Function, Code, Runtime
fn = Function(stack, 'MyFunction',
runtime=Runtime.PYTHON_3_9,
handler='index.handler',
code=Code.from_inline("def handler(event, context): return {'statusCode': 200}")
)
integration = HttpLambdaIntegration('MyIntegration', handler=fn)
api = HttpApi(stack, 'MyApi',
default_integration=integration
)
app.synth()