[Fixed] URGENT: Since yesterday evening HttpResponse() returns a None-object, breaking all download links of my app

What I’m trying to do:

Since yesterday evening suddenly none of the download links work anymore. I did not change anything in the code during the last week.

Here is the code (simplified to show you the error):

@anvil.server.http_endpoint("/test_bug/:row")
def test_bug(row, **params): #✔️
  r = anvil.server.HttpResponse()
  r.headers['content-disposition'] = 'attachment; filename="{}"'.format("test.apkg")

This is the error I get:

TypeError: ‘NoneType’ object does not support item assignmentat [ServerModule1, line 45](javascript:void(0))called from anvil/_server.py, line 1336

Line 45 would be the last line in the example above.

What I’ve tried and what’s not working:

An example from the docs:

@anvil.server.http_endpoint("/foo")
def serve_content():
  return anvil.server.HttpResponse(200, "Body goes here")

This one crashes with the following error:

AttributeError: ‘NoneType’ object has no attribute ‘_headers’
at anvil/_server.py, line 1343

Thanks for reporting - we’re looking into it

1 Like

That should now be fixed.

1 Like

Hi @tomka,

Apologies for the interruption here. There were two problems: Yesterday’s update contained a bug in its Python 2 backwards-compatibility, and our test suite failed to catch it. Both of these issues are now fixed, so this kind of thing shouldn’t be able to happen again.

Thanks very much for the bug report, and for your patience while we developed and shipped a fix.

2 Likes

Thank you for the quick fix! It would be great if there was some kind of notification when such an update dropped so users like me won’t assume it’s their fault (which is a fair assumption usually :laughing:). Luckily this time I didn’t work on the code for a week so it couldn’t have been me.