-
Notifications
You must be signed in to change notification settings - Fork 144
Django integration failing on exception #86
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
Comments
Hi, one quick question, are you using any serverless framework to deploy your Django app to AWS Lambda? |
No we just wrap it with a small WSGI conversion layer adapted from what other frameworks use (apig-wsgi) and bundle a custom zip. |
With the latest update (SDK 2.4.1) that allows middlewares to run on Lambda, I wonder if this issue has been fixed. |
I think I've got an instance of this, from code that does raise Http404 in a view. I think the bug is here:
Which fails if this is running in an AWS Lambda environment, as it's not dealing with the subsegment. By analogy with the Flask middleware the code should be:
But... I haven't yet written a test case to prove this! |
The above is in aws_xray_sdk.ext.django.middleware.XRayMiddleware |
Real time update: Workaround, replace the middleware with this middleware:
|
Hey, Thank you very much for the update and catching the issue! We will address this issue and create a pull request to fix it :) |
Fix exception processing in Django running in Lambda #86
The patch release has been pushed, so this change is now live on version 2.4.2! :) |
I'm using Django 2.0 on Python 3.6, with a view that raises
PermissionDenied
, which Django will convert to a 403 response, theXRayMiddleware
dies:I tried to replicate it in the test suite, but this passes for me (using Python 2.7 rather than 3.X, because I only have 3.7 on my local machine and various parts of this test suite don't work on 3.7):
It could be related to changes in Python 3.X, or Django 2.0 which isn't being tested here yet and I made #85 for.
The text was updated successfully, but these errors were encountered: