Code Monkey home page Code Monkey logo

Comments (9)

deepu1014git avatar deepu1014git commented on July 1, 2024

I have the similar issue with Python 3.11.4.
When I add "from aws_xray_sdk.core import patch_all" to my lambda handler, I see below error:

[ERROR] Runtime.ImportModuleError: Unable to import module 'handler': cannot import name 'formatargspec' from 'inspect' (/var/lang/lib/python3.11/inspect.py)

from aws-xray-sdk-python.

mxiamxia avatar mxiamxia commented on July 1, 2024

It looks formatargspec function has been deprecated which is not supported in Python 3.12.

DeprecationWarning: formatargspec is deprecated since Python 3.5. Use signature and the Signature object directly

from aws-xray-sdk-python.

Newlevel462 avatar Newlevel462 commented on July 1, 2024

it looks like aws-xray-sdk uses a package called wrapt which uses formatargspec

I think this is what is causing the error - please could you look into this

from aws-xray-sdk-python.

jj22ee avatar jj22ee commented on July 1, 2024

Hello, I've reproduced this error. It looks like this error occurs due to using wrapt versions < 1.14.

I've tested that customers error appears using wrapt==1.13.3 when installing my requirements.txt. I've tested that this error is gone when using wrapt==1.14 after deleting the previous installation of wrapt.

Could you check your wrapt version, remove the current version if it is older than 1.14, and upgrade to newer version?

from aws-xray-sdk-python.

Newlevel462 avatar Newlevel462 commented on July 1, 2024

unfortunately am still getting the same error when deploying the aws chalice lambda function

from aws-xray-sdk-python.

jj22ee avatar jj22ee commented on July 1, 2024

When tested on my end with Chalice, I had to delete all the current downloaded dependencies (including wrapt) and then reinstall with pip3 install -r requirements.txt -t . to apply the updated wrapt, else I would still get the previous error. Have you tried deleting previous version of wrapt in your Lambda?

from aws-xray-sdk-python.

Newlevel462 avatar Newlevel462 commented on July 1, 2024

yes

from aws-xray-sdk-python.

jj22ee avatar jj22ee commented on July 1, 2024

My repro attempt steps:

Followed guide in https://github.com/aws/chalice?tab=readme-ov-file#quickstart until Deploying section.

  • python3.12 -m ensurepip --upgrade -> installed pip-23.2.1
  • python --version -> Python 3.12.1
  • requirements.txt includes:
chalice==1.31.0
aws-xray-sdk==2.12.0
wrapt==1.16
  • Modified app.py to include:
import json
from chalice import Chalice
from aws_xray_sdk.core import patch_all, xray_recorder
  • Ran:
pip3 install -r requirements.txt -t .
chalice deploy
  • Lambda confirmed to use Python 12 and executes with no error.

With this setup, I cannot reproduce issue. Changing wrapt version to 1.13.3 will reproduce the error, but then deleting all vendored dependencies and then removing wrapt entirely from requirements.txt will also fix the error when running chalice deploy.


@Newlevel462 Is there any other info you can provide about your chalice app configuration? Current I assume that the XRay Python SDK is compatible with Python 12 since I was able to get it working with the above repro steps. Possibly there is a configuration issue with the Chalice Application on your end. Perhaps, could you provide pip3 version you are using?

from aws-xray-sdk-python.

Newlevel462 avatar Newlevel462 commented on July 1, 2024

thanks it works now

from aws-xray-sdk-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.