content-analysis-on-aws icon indicating copy to clipboard operation
content-analysis-on-aws copied to clipboard

WebsiteDeployHelper - Runtime Python3.6

Open WulfenSan opened this issue 3 years ago • 2 comments

Describe the bug WebsiteDeployHelper is failing to create. Embedded stack arn:aws:cloudformation:us-east-1:xxxxxxxx:stack/ContAnalyz-WebStack-NAV0C7BT3YE7/8ea78950-18f2-11ed-a065-0e987b47ea9f was not successfully created: The following resource(s) failed to create: [WebsiteDeployHelper].

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: 9c7293a7-99d7-4e54-992c-0a00d3fc612b)" (RequestToken: 88e80d66-96e9-b03f-ce72-c97a67334ed9, HandlerErrorCode: InvalidRequest)

To Reproduce Create stack with aws-content-analysis template.

Expected behavior Creation of WebStack resource.

Please complete the following information about the solution:

  • [v2.0.0] Version: [e.g. v1.0.0]
  • [us-east-1] Region: [e.g. us-east-1]
  • [No] Was the solution modified from the version published on this repository?
  • [ ] If the answer to the previous question was yes, are the changes available on GitHub?
  • [Yes] Have you checked your service quotas for the sevices this solution uses?
  • [See bug description] Were there any errors in the CloudWatch Logs?

WulfenSan avatar Aug 11 '22 15:08 WulfenSan

Hey @WulfenSan ,

My team was trying to implement the content analysis and we ran into the same issue as you, not sure if you ever figured this out on your own but I'll leave the solution here for you and anyone else that may come across this thread.

So stack creation follows the template of aws-content-analysis.yaml. Everything works fine until the WebStack, and if you look at aws-content-analysis-web.yaml here you see where we get the runtime error.

Some of the source code is provided in this repo but if you look through the templates you'll see that everything is actually getting built by pulling from an S3 bucket called rodeolabz. We need to fix some of theses file so we'll be creating our own versions.

So steps to fix this are as follows:

  1. Create your own S3 bucket & directory for templates (I called mine "my-templates/aws-content-analysis")
  2. Go to this link to download the rodeolabz websitehelper.zip
  3. Go to this link for the web template and open it.
  4. Change line 50 and line 291 to Runtime: python3.9, change the WebsiteDeployHelper Properties to reference your new websitehelper.zip like so
Properties:
      Code:
        S3Bucket:  "my-templates"
        S3Key:
          !Join [
              "/",
            [
              "aws-content-analysis",
              "websitehelper.zip",
            ],
          ]
  1. Upload both files to your S3 bucket/directory
  2. Copy aws-content-analysis.yaml somewhere and save it as a .template
  3. Go to AWS CloudFormation>Designer. Open aws-content-analysis.template. Add some mappings that will point to your personal template bucket. My mappings look like this
   SourceCode:
      GlobalS3Bucket: "rodeolabz-us-east-1"
      TemplateKeyPrefix: "aws-content-analysis/v2.0.0"
      RegionalS3Bucket: "rodeolabz-us-east-1"
      CodeKeyPrefix: "aws-content-analysis/v2.0.0"
      Version: v2.0.0
      PersonalS3Bucket: "my-templates"
      WebStackPrefix: "aws-content-analysis"
  1. Still in the editor, where you build your WebStack url point to your new template bucket instead of rodeolabz (only for WebStack). Like this
      TemplateURL: !Join
        - ""
        - - "https://"
          - !FindInMap
            - Application
            - SourceCode
            - PersonalS3Bucket
          - ".s3.amazonaws.com/"
          - !FindInMap
            - Application
            - SourceCode
            - WebStackPrefix
          - "aws-content-analysis-web.template"

And that's it! Now you bypass the python runtime error and you can continue through the README to finish setting up the content analysis website. If I missed anything let me know, it might be from website_helper.py in the zip file.

kyyyyylehead avatar Aug 26 '22 01:08 kyyyyylehead

Thanks for that, @kyyyyylehead! I was going through those steps, and after some additional work noticed that the base template had a new version. Ran it just to confirm, and it looks like it's now been fixed. But I definitely appreciate the thorough workaround effort!

WulfenSan avatar Aug 29 '22 19:08 WulfenSan