Python/Endpoints: Workaround for known Exception content-length issue?

78 views
Skip to first unread message

Michael Spainhower

unread,
Aug 20, 2015, 1:44:22 AM8/20/15
to Google App Engine
Has anyone found a good workaround (not patching the library) for the issue (https://code.google.com/p/googleappengine/issues/detail?id=10544) that prevents testing Exceptions raised in Endpoints handlers?

If you are unfamiliar with the issue, when an Endpoints handler raises an Exception during an automated test, the content-length of the response is not updated according to the content size of the serialized Exception and raises "AssertionError: Content-Length is different from actual app_iter length (512!=93)"

Hopefully the real fix is released soon.  Even though this is a dev and testing, not production, issue, not being able to test Exception handling is a pretty significant issue as far as non-production issues go.

Nick (Cloud Platform Support)

unread,
Sep 10, 2015, 6:57:28 PM9/10/15
to Google App Engine
Hey Michael,

Thanks for bringing this up. We're currently working on getting this fixed. Is there any reason the patch suggested in the linked stackoverflow question won't help with your SDK for now? 

Best wishes,

Nick

Nick (Cloud Platform Support)

unread,
Sep 10, 2015, 6:58:02 PM9/10/15
to Google App Engine
It's worth noting that the line numbers for the patch have changed slightly, but the relevant code can still be patched.

Michael Spainhower

unread,
Sep 10, 2015, 7:11:23 PM9/10/15
to Google App Engine
> the line numbers for the patch have changed slightly

That is basically the answer.  On CI runs we always bring in the latest SDK release, so we would have to both script the patching to run on CI (not terrible) and keep it up-to-date along with SDK updates (not something I wish to do).

For now I have been structuring my code so I can test Exceptions in non-Endpoints unit tests.  I prefer to just refactor code and tests later (on our schedule) rather than have things break on CI unexpectedly.


> We're currently working on getting this fixed

Awesome, glad to hear it!


cheers
Reply all
Reply to author
Forward
0 new messages