[FIXED] Anvil.http.request error: invalid json in response

I noticed this across a few of my apps, as of recently http requests have been causing errors that did not arise earlier.

for example:

sim_voters_url = 'https://randomuser.me/api/?results='+str(len(prize_winners))
voters = anvil.http.request(sim_voters_url, method='GET', json=True)

raises this error:
HttpErrorStatus: Invalid JSON in response

This is happening on all my apps that use anvil.http.request. Does anyone know what might be happening?

I can reproduce this: it appears to be happening in Server Modules but not client code. Moving to Bug Reports. Thanks for the report, and apologies for the inconvenience.

Update: This bug only exists in the Basic Python 2 environment. Full Python 2 and Full Python 3 both do not have this problem.

So you can work around the problem for now by switching your apps to Full Python 2 or Full Python 3, if possible.

1 Like

My server modules actually are running full python 2 environment. Should i migrate to python3?

Eventually, perhaps, but we will continue to support Full Python 2 for the medium term (probably past the official Python 2 End of Life next year).

1 Like

This issue is now fixed in the Basic Python 2 environment.

1 Like