aws-samples / react-ssr-lambda

Demo of server side rendering for React application on AWS Lambda
MIT No Attribution
107 stars 24 forks source link

problem when deploying edge lamda function #40

Closed rocchisanijl closed 1 year ago

rocchisanijl commented 1 year ago

Hi I got this error message when executing last command to delpoy example "cdk deploy SSRAppStack --parameters mySiteBucketName=demo-appssr.jlrrocc.net" it seems something is no more supported in the script to create the lamba perhaps CDK version is not updated ?

15:57:08 | CREATE_FAILED | AWS::Lambda::Function | CustomCDKBucketDep...CC9EB8756C81C01536 Resource handler returned message: "The runtime parameter of python3.6 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (python3.9) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 0f0508e4-0922-446a-8535-26bc2924cb68)" ( RequestToken: eafa215b-5a68-4682-31e0-027450395044, HandlerErrorCode: InvalidRequest)

    new Function (/home/jlrocc/Documents/react-ssr-lambda/cdk/node_modules/@aws-cdk/aws-lambda/lib/function.ts:369:35)
    \_ SingletonFunction.ensureLambda (/home/jlrocc/Documents/react-ssr-lambda/cdk/node_modules/@aws-cdk/aws-lambda/lib/singleton-lambda.ts:93:12)
    \_ new SingletonFunction (/home/jlrocc/Documents/react-ssr-lambda/cdk/node_modules/@aws-cdk/aws-lambda/lib/singleton-lambda.ts:32:32)
    \_ new BucketDeployment (/home/jlrocc/Documents/react-ssr-lambda/cdk/node_modules/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts:87:21)
    \_ new SsrStack (/home/jlrocc/Documents/react-ssr-lambda/cdk/lib/srr-stack.ts:37:5)
    \_ Object.<anonymous> (/home/jlrocc/Documents/react-ssr-lambda/cdk/bin/cdk.ts:13:1)
    \_ Module._compile (node:internal/modules/cjs/loader:1105:14)
    \_ Module.m._compile (/home/jlrocc/Documents/react-ssr-lambda/cdk/node_modules/ts-node/src/index.ts:858:23)
    \_ Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    \_ Object.require.extensions.<computed> [as .ts] (/home/jlrocc/Documents/react-ssr-lambda/cdk/node_modules/ts-node/src/index.ts:861:12)
    \_ Module.load (node:internal/modules/cjs/loader:981:32)
    \_ Function.Module._load (node:internal/modules/cjs/loader:822:12)
    \_ Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    \_ main (/home/jlrocc/Documents/react-ssr-lambda/cdk/node_modules/ts-node/src/bin.ts:227:14)
    \_ Object.<anonymous> (/home/jlrocc/Documents/react-ssr-lambda/cdk/node_modules/ts-node/src/bin.ts:513:3)
    \_ Module._compile (node:internal/modules/cjs/loader:1105:14)
    \_ Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    \_ Module.load (node:internal/modules/cjs/loader:981:32)
    \_ Function.Module._load (node:internal/modules/cjs/loader:822:12)
    \_ Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

❌ SSRAppStack failed: Error: The stack named SSRAppStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_FAILED (The following resource(s) failed to delete: [ssrEdgeHandler443FC458]. ): Resource handler returned message: "The runtime parameter of python3.6 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (python3.9) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 0f0508e4-0922-446a-8535-26bc2924cb68)" (RequestToken: eafa215b-5a68-4682-31e0-027450395044, HandlerErrorCode: InvalidRequest), Resource handler returned message: "Lambda was unable to delete arn:aws:lambda:us-east-1:206324621659:function:SSRAppStack-ssrEdgeHandler443FC458-doKJa3827w3e:1 because it is a replicated function. Please see our documentation for Deleting Lambda@Edge Functions and Replicas. (Service: Lambda, Status Code: 400, Request ID: fc3c3d0b-66ff-480e-b68e-a12cdfcdabdb)" (RequestToken: 85513bea-7632-8772-5ce0-b26471ba8ffd, HandlerErrorCode: InvalidRequest) at prepareAndExecuteChangeSet (/usr/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:386:13) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at CdkToolkit.deploy (/usr/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:219:24) at initCommandLine (/usr/lib/node_modules/aws-cdk/lib/cli.ts:347:12)

NOTICES

19836 AWS CDK v1 has entered maintenance mode

    Overview: AWS CDK v1 has entered maintenance mode on June 1, 2022.
              Migrate to AWS CDK v2 to continue to get the latest features
              and fixes!

    Affected versions: framework: 1.*, cli: 1.*

    More information at: https://github.com/aws/aws-cdk/issues/19836

If you don’t want to see a notice anymore, use "cdk acknowledge ". For example, "cdk acknowledge 19836". The stack named SSRAppStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_FAILED (The following resource(s) failed to delete: [ssrEdgeHandler443FC458]. ): Resource handler returned message: "The runtime parameter of python3.6 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (python3.9) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 0f0508e4-0922-446a-8535-26bc2924cb68)" (RequestToken: eafa215b-5a68-4682-31e0-027450395044, HandlerErrorCode: InvalidRequest), Resource handler returned message: "Lambda was unable to delete arn:aws:lambda:us-east-1:206324621659:function:SSRAppStack-ssrEdgeHandler443FC458-doKJa3827w3e:1 because it is a replicated function. Please see our documentation for Deleting Lambda@Edge Functions and Replicas. (Service: Lambda, Status Code: 400, Request ID: fc3c3d0b-66ff-480e-b68e-a12cdfcdabdb)" (RequestToken: 85513bea-7632-8772-5ce0-b26471ba8ffd, HandlerErrorCode: InvalidRequest)

adhinneupane commented 1 year ago

Hey, since aws recently made 3.6 python obsolete for lambda functions, looks like the cdk needs to imply 3.9 as cloudformation parameter. Can you please take a look at this? @roman-boiko ?

adhinneupane commented 1 year ago

Could there also be an adhoc solution by changing the runtime parameter to 3.9 in cloudformation template itself ?

roman-boiko commented 1 year ago

Updated CDK version and made other fixes