aws-samples / aws-serverless-workshop-innovator-island

Welcome to the Innovator Island serverless workshop! This repo contains all the instructions and code you need to complete the workshop.
MIT No Attribution
564 stars 228 forks source link

The base layer for theme-park-photos-chromakey lambda function in eu-central-1 is missing cv2 dependency #7

Closed mr-cell closed 4 years ago

mr-cell commented 4 years ago

Hello, I'm following the current edition of AWS Serverless Innovator Island Workshops.

I have been following the steps described in Module 3 Subsection 1 of the workshops (as defined here: https://github.com/aws-samples/aws-serverless-workshop-innovator-island/blob/master/3-photos/1-chromakey/README.md).

However, it seems that the base layer for theme-park-photos-chromakey lambda function (as defined here: https://github.com/aws-samples/aws-serverless-workshop-innovator-island/blob/master/3-photos/1-chromakey/README.md in eu-central-1 - arn:aws:lambda:eu-central-1:678705476278:layer:Chromakey:1) is missing the cv2 dependency.

Sending a test event of:

{
  "Records": [
      {
          "s3": {
              "bucket": {
                  "name": "theme-park-backend-uploadbucket-1hnjnkn2kab67"
              },
              "object": {
                  "key": "green-screen-test.png"
              }
          }
      }
    ]
}

Results in following execution result:

{
  "errorMessage": "Unable to import module 'lambda_function': No module named 'cv2'",
  "errorType": "Runtime.ImportModuleError"
}
START RequestId: d0fcfed7-9a4c-4201-9f31-669fd1b82e70 Version: $LATEST
[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'cv2'END RequestId: d0fcfed7-9a4c-4201-9f31-669fd1b82e70
REPORT RequestId: d0fcfed7-9a4c-4201-9f31-669fd1b82e70  Duration: 2.05 ms   Billed Duration: 100 ms Memory Size: 3008 MB    Max Memory Used: 53 MB  Init Duration: 119.05 ms    

Is this something you could verify?

jbesw commented 4 years ago

Can you double-check that you set the function runtime to Python 3.6 and not another version? This is the most common reason for this error. Thanks!

mr-cell commented 4 years ago

@jbesw thank you for the quick response - that was indeed the cause (I've set Python 3.8 as runtime env). After switching to Python3.6 the error is gone. Thanks, I'll go ahead and close the issue!