Skip to content
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

When using the export command, a Lambda function with Python 3.7 is automatically generated. #13750

Closed
kazuki-takaya-sp opened this issue May 1, 2024 · 5 comments
Labels
pending-triage Issue is pending triage question General question

Comments

@kazuki-takaya-sp
Copy link

Amplify CLI Version

12.5.1

Question

When exporting CDK using the export command, the automatically created Lambda function is set to Python version 3.7, causing build failures.
What steps should be taken to address this issue?
I followed the instructions on the following URL to perform the export and CDK construction:
https://aws.amazon.com/jp/blogs/mobile/export-amplify-backends-to-cdk-and-use-with-existing-deployment-pipelines/

Extract from the automatically created CloudFormation stack:

    "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536": {
      "Type": "AWS::Lambda::Function",
      "Properties": {
        "Code": {
          "S3Bucket": {
            "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
          },
          "S3Key": "a3058ccb468d757ebb89df5363a1c20f5307c6911136f29d00e1a68c9b2aa7e8.zip"
        },
        "Role": {
          "Fn::GetAtt": [
            "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265",
            "Arn"
          ]
        },
        "Handler": "index.handler",
        "Layers": [
          {
            "Ref": "assetAppsyncApplicationNamedeploymentAwsCliLayer8A65489E"
          }
        ],
        "Runtime": "python3.7",
        "Timeout": 900
      },
      "DependsOn": [
        "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF",
        "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265"
      ],
      "Metadata": {
        "aws:cdk:path": "ApplicationName/amplifyStage/AmplifyStack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/Resource",
        "aws:asset:path": "../asset.a3058ccb468d757ebb89df5363a1c20f5307c6911136f29d00e1a68c9b2aa7e8",
        "aws:asset:property": "Code"
      }
    },
@kazuki-takaya-sp kazuki-takaya-sp added pending-triage Issue is pending triage question General question labels May 1, 2024
@ykethan
Copy link
Member

ykethan commented May 2, 2024

Hey @kazuki-takaya-sp, could you provide some information on the build failures you are experiencing on the export command. Any notable error messages?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label May 2, 2024
@kazuki-takaya-sp
Copy link
Author

Hi @ykethan
The following error message is being displayed.
The target ID being created is CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536, and it is believed to be an automatically created resource.
Can the issue be resolved by upgrading Amplify CLI?

Resource handler returned message: "The runtime parameter of python3.7 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (python3.12) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 3858764d-fd31-436d-baff-7024c6c7ab74)" (RequestToken: 3c5dcc18-eb65-319e-97f5-b706d8078310, HandlerErrorCode: InvalidRequest)

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label May 7, 2024
@kazuki-takaya-sp
Copy link
Author

hi @ykethan
This issue has been resolved. It turns out the problem was due to implementing based on a sample, which was built using AWS-CDK v1
Updating to AWS-CDK V2 resolved this issue. Thank you for your assistance.

@ykethan
Copy link
Member

ykethan commented May 7, 2024

@kazuki-takaya-sp glad to hear you were able to resolve the issue. Closing this issue, do reach out if you are experiencing any issues with Amplify CLI

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2024
Copy link

github-actions bot commented May 7, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-triage Issue is pending triage question General question
Projects
None yet
Development

No branches or pull requests

2 participants