-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError masks original exception #281
Comments
Hello @rittneje ,
The above error message correctly indicates that module named ABC could not be imported. Let us know if any other issue is present. Thank you! |
@aavinash-nr That is not a trace. As you can see, it did not output the original exception type or traceback. As I mentioned in the issue description, it only outputs the text of the original exception, which is not helpful in general. Please re-open this issue. |
@aavinash-nr Following up on this. Please re-open this issue. |
Hi @rittneje |
@chaudharysaket Please re-read the issue description. The problem is not For example, if my main module does: import os
ABC = os.environ["ABC"] and there is no
|
newrelic-lambda-layers/python/newrelic_lambda_wrapper.py
Line 65 in 48654ab
If importing the main module fails, this takes the original exception, converts to to a string, and then appends to the
ImportError
, which masks details about the original exception, including its actual stack trace, and the type of exception.As an example, suppose my main module does
os.environ["ABC"]
, where there is noABC
environment variable. With the current code, I get:That does not make it clear at all what the problem is, or even that it was a
KeyError
.Ideally, this wrapper would instead do something like:
Unfortunately, it sounds like the Lambda runtime neglects to output the exception chain properly. https://stackoverflow.com/questions/62112585/aws-lambda-not-showing-cause-exception-stacktrace-in-python-3-8
So this wrapper may instead need to collect the traceback (and exception type) itself, and glue all of that into the
ImportModuleError
.The text was updated successfully, but these errors were encountered: