0

I try to use AWS Lambda layer with opcua-asyncio libary but I got on my greengrass client the following error message:

Failed to import handler function "lambda_function.lambda_handler" due to exception: No module named 'asyncua'

What I did:

mkdir layer
cd layer
mkdir python
cd python
pip3 install asyncua -t .
cd ..
zip -r layer.zip python*

Uploaded that file as layer, with compatible runtimes: python3.8 and use that layer with the following lambda_function.py

import json
import asyncua

def lambda_handler(event, context):
    # TODO implement
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda!')
    }

When I use the Test function I get no error and the response:

Response
{
  "statusCode": 200,
  "body": "\"Hello from Lambda!\""
}

But the published version of that lambda function doesn't work... see the error code at the beginning. I also tried with other libaries like pandas and its the same error ;(

I also tried different folder structure for the layer.zip:

python/lib/python3.8/site-packages/{LibrariesGoHere}.

Can someone help?

1
  • Are you testing this in AWS Lambda (where it works) and then deploying the Lambda function to AWS IoT Greengrass (where it doesn't work)? I don't use Greengrass much, but does it support layers? I don't see mention of layers in the Greengrass docs. Commented Jan 27, 2022 at 20:17

1 Answer 1

2

I found the answer to my question:

are-lambda-layers-supported-for-lambdas-deployed-to-greengrass

AWS lambda layers are not supported with greengrass core :(

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.