Upgrading to 3.77.0 & Python 3.9 Results in Import Error

Open
#684 7 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
aws, python
Domain
cloud, devops

Research direction

Start with latest.yaml and the lambda_function entry point, then reproduce the deployment on Python 3.9 and inspect why ddtrace.internal cannot provide _rand. Done means the CloudFormation update completes and the Log Forwarder handles invocations successfully on Python 3.9 without the import error.

Written by the indexing model from the issue text.

Description

Describe what happened:
We use the DD provided cloudformation stack to deploy the Lambda Log forwarder. However it was on version 3.59.0. We upgraded to 3.77.0 using the latest.yaml template. The update went through, but suddenly the lambda failed all invocations with the following:

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': cannot import name '_rand' from 'ddtrace.internal' (/var/task/ddtrace/internal/__init__.py)
Traceback (most recent call last):

Manually changing the run time from Python 3.9 to 3.8 fixed this issue.

As a result we rolled back to 3.73.0 which is the last Python 3.8 deployment, and everything is working OK.

Describe what you expected:
Expected to run latest.yaml Cloudformation template and the Log Forwarder to work.

Steps to reproduce the issue:
Deployed latest.yaml as an update to our CloudFormation stack.

Dominant language
Python
Stars
351
Forks
397
Avg merge
5h 50m
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/datadog-serverless-functions

All issues in DataDog/datadog-serverless-functions

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.