[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'aws_xray_sdk'
- Vorherrschende Sprache
- Python
- Sterne
- 338
- Forks
- 147
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Beitragsleitfaden
Rechercherichtung
Beginne mit buildspec.yml und untersuche das bereitgestellte Lambda-Artefakt, um zu überprüfen, ob aws_xray_sdk zusammen mit dem Funktionscode enthalten ist. Vergleiche die Packaging-Schritte mit den verlinkten Leitfäden zu AWS CodeStar und Lambda-Tracing; abgeschlossen ist die Aufgabe, wenn die bereitgestellte Funktion das SDK importiert, ohne dass Runtime.ImportModuleError auftritt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- aws, python
- Bereich
- backend, cloud
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100