Skip to content

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'aws_xray_sdk' #187

@PedroMBPinheiro

Description

@PedroMBPinheiro

Hi,

I am using AWS Codestar to develop a python lambda function.

I added X-Ray support following https://docs.aws.amazon.com/codestar/latest/userguide/customize-project-xray.html and added pip install aws-xray-sdk to my buildspec.yml

  # Upgrade AWS CLI to the latest version
  - pip install --upgrade awscli
  
  # Upgrade AWS X-Ray SDK
  - pip install --upgrade aws-xray-sdk

Add instrumented my code as per https://docs.aws.amazon.com/lambda/latest/dg/python-tracing.html.

But CloudWatch Logs always show this error.

START RequestId: f785062e-6687-496a-91a9-653e0127d2d0 Version: 8

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda/s3_trigger_start_notebook_function': No module named 'aws_xray_sdk'

END RequestId: f785062e-6687-496a-91a9-653e0127d2d0

REPORT RequestId: f785062e-6687-496a-91a9-653e0127d2d0 Duration: 13.87 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 69 MB Init Duration: 293.24 ms
XRAY TraceId: 1-5de586ab-3073f132c67bc0163d18fd9b SegmentId: 1ebd10451b253bf7 Sampled: true

There is no requirements.txt by default in CodeStar projects. What is missing here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions