-
Notifications
You must be signed in to change notification settings - Fork 246
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
aws-lambda-python-alpha: panic: JsiiError: @jsii/kernel.Fault Module '@aws-cdk/aws-lambda-python-alpha' not found #4737
Comments
@kaykhan Good morning. If you check https://pkg.go.dev/github.com/aws/aws-cdk-go/awscdklambdapythonalpha/v2, the latest version is module cdktest-go
go 1.22.0
toolchain go1.22.10
require (
github.com/aws/aws-cdk-go/awscdk/v2 v2.173.1
github.com/aws/aws-cdk-go/awscdklambdapythonalpha/v2 v2.173.1-alpha.0
github.com/aws/constructs-go/constructs/v10 v10.4.2
github.com/aws/jsii-runtime-go v1.104.0
)
require (
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/cdklabs/awscdk-asset-awscli-go/awscliv1/v2 v2.2.208 // indirect
github.com/cdklabs/awscdk-asset-kubectl-go/kubectlv20/v2 v2.1.3 // indirect
github.com/cdklabs/awscdk-asset-node-proxy-agent-go/nodeproxyagentv6/v2 v2.1.0 // indirect
github.com/cdklabs/cloud-assembly-schema-go/awscdkcloudassemblyschema/v38 v38.0.1 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/yuin/goldmark v1.4.13 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/tools v0.26.0 // indirect
) Take note of declaration cdktest-go.go package main
import (
"github.com/aws/aws-cdk-go/awscdk/v2"
"github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
"github.com/aws/aws-cdk-go/awscdklambdapythonalpha/v2"
"github.com/aws/constructs-go/constructs/v10"
"github.com/aws/jsii-runtime-go"
)
type CdktestGoStackProps struct {
awscdk.StackProps
}
func NewCdktestGoStack(scope constructs.Construct, id string, props *CdktestGoStackProps) awscdk.Stack {
var sprops awscdk.StackProps
if props != nil {
sprops = props.StackProps
}
stack := awscdk.NewStack(scope, &id, &sprops)
awscdklambdapythonalpha.NewPythonFunction(stack, jsii.String("MyFunction"), &awscdklambdapythonalpha.PythonFunctionProps{
Entry: jsii.String("./lib/lambda"),
Runtime: awslambda.Runtime_PYTHON_3_8(),
Index: jsii.String("testlambda.py"),
Handler: jsii.String("lambda_handler"),
})
return stack
}
func main() {
defer jsii.Close()
app := awscdk.NewApp(nil)
NewCdktestGoStack(app, "CdktestGoStack", &CdktestGoStackProps{
awscdk.StackProps{
Env: env(),
},
})
app.Synth(nil)
}
// env determines the AWS environment (account+region) in which our stack is to
// be deployed. For more information see: https://docs.aws.amazon.com/cdk/latest/guide/environments.html
func env() *awscdk.Environment {
// If unspecified, this stack will be "environment-agnostic".
// Account/Region-dependent features and context lookups will not work, but a
// single synthesized template can be deployed anywhere.
//---------------------------------------------------------------------------
return nil
// Uncomment if you know exactly what account and region you want to deploy
// the stack to. This is the recommendation for production stacks.
//---------------------------------------------------------------------------
// return &awscdk.Environment{
// Account: jsii.String("123456789012"),
// Region: jsii.String("us-east-1"),
// }
// Uncomment to specialize this stack for the AWS Account and Region that are
// implied by the current CLI configuration. This is recommended for dev
// stacks.
//---------------------------------------------------------------------------
// return &awscdk.Environment{
// Account: jsii.String(os.Getenv("CDK_DEFAULT_ACCOUNT")),
// Region: jsii.String(os.Getenv("CDK_DEFAULT_REGION")),
// }
} lib/lambda/testlambda.py import boto3
import botocore
def lambda_handler(event, context):
print(f'boto3 version: {boto3.__version__}')
print(f'botocore version: {botocore.__version__}') Before running
Please check if Thanks, |
go.mod file
I am using github.com/aws/aws-cdk-go/awscdklambdapythonalpha/v2 v2.173.1-alpha.0 |
I wonder if it has something to do with the github.com/aws/jsii-runtime-go version update with aws-cdk? unforutantly im not able to donwgrade to version github.com/aws/jsii-runtime-go v1.104.0 like you have in yours as it looks like there is a dependent project relying on the newest v1.105.0
|
@kaykhan Assuming if this is the case, please wait for sometime before trying again. As packages for different languages are released, it might take some time for package managers to get updated. |
v1.105.0 It was released last month, could you try bump it in your sample project and retest? and again i'm not entirely sure if it the issue, so would be good to confirm |
@ashishdhingra we downgraded to 1.0.4 and still getting the same error. panic: JsiiError: @jsii/kernel.Fault Module '@aws-cdk/aws-lambda-python-alpha' not found
|
@ashishdhingra Apologise again for another message - but i come with good news - a reproducible minimal example. https://github.com/kaykhan/aws-lambda-python-alpha-kernal-fault-jsii
The issue occurs when introducing the Why is the above is causing a kernal fault and preventing the awscdklambdapythonalpha.NewPythonFunction is the main issue as the hooks themselves work correctly.
Please do test and confirm the bug and get back to us. |
@kaykhan Good morning. Thanks for opening the issue. This issue was initially reported when using Using your sample minimal reproducible code from https://github.com/kaykhan/aws-lambda-python-alpha-kernal-fault-jsii
Notice your
Environment details:
It produced below CloudFormation templates in {
"Resources": {
"MyFunctionServiceRole3C357FF2": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
},
"Metadata": {
"aws:cdk:path": "NewCdkGoTestAppGoStack/MyFunction/ServiceRole/Resource"
}
},
"MyFunction3BAA72D1": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "6edd379be82f84e013de4cca9d53a3bb281faae816d89a44420c3b9fc23123d1.zip"
},
"Handler": "bootstrap",
"Role": {
"Fn::GetAtt": [
"MyFunctionServiceRole3C357FF2",
"Arn"
]
},
"Runtime": "provided.al2"
},
"DependsOn": [
"MyFunctionServiceRole3C357FF2"
],
"Metadata": {
"aws:cdk:path": "NewCdkGoTestAppGoStack/MyFunction/Resource",
"aws:asset:path": "asset.6edd379be82f84e013de4cca9d53a3bb281faae816d89a44420c3b9fc23123d1",
"aws:asset:is-bundled": true,
"aws:asset:property": "Code"
}
},
"CDKMetadata": {
"Type": "AWS::CDK::Metadata",
"Properties": {
"Analytics": "v2:deflate64:H4sIAAAAAAAA/0WOSw6CMBCGz8K+HRSMblUS3eMBzFAKjpSpYdpoQri7QTSuvsX/zGC9y2HMEnyKNnWnHVUwXgKaTuFTriNhD2PpnVVFwzMnJfkVRWwQOMxQksMxms6GI4pVDvuqRigaPkU2gTxPqrTi42Cs+gQuAVvi9lP4E4qGC881Lf5Mo3vcEFbJ/vsrnblU69Z/5bP/T7R+DVkOm9QRx1eKfb3dJHch0kPkQL2FcuEbFmTErvIAAAA="
},
"Metadata": {
"aws:cdk:path": "NewCdkGoTestAppGoStack/CDKMetadata/Default"
},
"Condition": "CDKMetadataAvailable"
}
},
"Conditions": {
"CDKMetadataAvailable": {
"Fn::Or": [
{
"Fn::Or": [
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"af-south-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-east-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-northeast-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-northeast-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-northeast-3"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-south-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-south-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-southeast-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-southeast-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-southeast-3"
]
}
]
},
{
"Fn::Or": [
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-southeast-4"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ca-central-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ca-west-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"cn-north-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"cn-northwest-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-central-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-central-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-north-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-south-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-south-2"
]
}
]
},
{
"Fn::Or": [
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-west-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-west-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-west-3"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"il-central-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"me-central-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"me-south-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"sa-east-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"us-east-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"us-east-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"us-west-1"
]
}
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"us-west-2"
]
}
]
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
} NewCdkPythonTestAppGoStack.template.json {
"Resources": {
"MyFunctionServiceRole3C357FF2": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
},
"Metadata": {
"aws:cdk:path": "NewCdkPythonTestAppGoStack/MyFunction/ServiceRole/Resource"
}
},
"MyFunction3BAA72D1": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "27f9f3c41bb3edb391df713137c497dd4c43ad7e9c9eb3fbfc1dfc69b6e7f3fc.zip"
},
"Handler": "testlambda.lambda_handler",
"Role": {
"Fn::GetAtt": [
"MyFunctionServiceRole3C357FF2",
"Arn"
]
},
"Runtime": "python3.8"
},
"DependsOn": [
"MyFunctionServiceRole3C357FF2"
],
"Metadata": {
"aws:cdk:path": "NewCdkPythonTestAppGoStack/MyFunction/Resource",
"aws:asset:path": "asset.27f9f3c41bb3edb391df713137c497dd4c43ad7e9c9eb3fbfc1dfc69b6e7f3fc",
"aws:asset:is-bundled": true,
"aws:asset:property": "Code"
}
},
"CDKMetadata": {
"Type": "AWS::CDK::Metadata",
"Properties": {
"Analytics": "v2:deflate64:H4sIAAAAAAAA/0WOwQ6CMBBEv4V7uygYvaokng1+gFlLwZWyJW4bNcR/N4DG08tkZ2Yng+UmhyFL8CHaVK12dIHhFNC0Ch9yHgg7GErvrCpqHvlWkp9RxAaB3QglOeyjaW3Yo1jlsLtUCEXNh8gmkOe3Kq34eDdWTYFTwIa4mQp/h6LmwnNFsz/T6PorwiLZfnelI+dq3b/C1fPXcpzE/1Xjl5DlsEodcXym2FXrVXITIn2PHKizUM78APd1o7r6AAAA"
},
"Metadata": {
"aws:cdk:path": "NewCdkPythonTestAppGoStack/CDKMetadata/Default"
},
"Condition": "CDKMetadataAvailable"
}
},
"Conditions": {
"CDKMetadataAvailable": {
"Fn::Or": [
{
"Fn::Or": [
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"af-south-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-east-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-northeast-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-northeast-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-northeast-3"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-south-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-south-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-southeast-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-southeast-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-southeast-3"
]
}
]
},
{
"Fn::Or": [
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ap-southeast-4"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ca-central-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"ca-west-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"cn-north-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"cn-northwest-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-central-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-central-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-north-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-south-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-south-2"
]
}
]
},
{
"Fn::Or": [
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-west-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-west-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-west-3"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"il-central-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"me-central-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"me-south-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"sa-east-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"us-east-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"us-east-2"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"us-west-1"
]
}
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"us-west-2"
]
}
]
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
} I'm unsure what's the issue in your environment and if we would be able to troubleshoot environment specific issue. Thanks, |
@ashishdhingra Please use the command in my instructions so that it targets the exact application and does not target the default one - The issue is a conflict when using both @aws-cdk/aws-lambda-go-alpha @aws-cdk/aws-lambda-python-alpha in the same application where @aws-cdk/aws-lambda-go-alpha is using a CommandHook during bundling. |
Reproducible with |
Describe the bug
I want to deploy a python function using https://docs.aws.amazon.com/cdk/api/v2/docs/aws-lambda-python-alpha-readme.html
However i get the error panic: JsiiError: @jsii/kernel.Fault Module '@aws-cdk/aws-lambda-python-alpha' not found
when i run any cdk command.
I installed using.
go get -u github.com/aws/aws-cdk-go/awscdklambdapythonalpha/v2
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
Expect to be able to use awscdklambdapythonalpha construct to deploy a python function in my go code.
Current Behavior
cdk ls --app "go run bin/ch/main.go"
Reproduction Steps
go get -u github.com/aws/aws-cdk-go/awscdklambdapythonalpha/v2
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.173.1 (build 4eac959)
Framework Version
No response
Node.js Version
20.14
OS
Ubuntu 24
Language
Go
Language Version
1.23.3
Other information
No response
The text was updated successfully, but these errors were encountered: