Although navigating to defined routes from within an app seems to work, entering one of those routes directly into browser tab results in the following error message:
Cannot send a SerializedPythonObject object over HTTP as response.
You must return either Media, a string, or a JSON-compatible object (lists/dicts/strings/numbers/None).
It is no longer happening with Stefano’s example app (perhaps because it is hosted on “anvil.app”?), but I’m still getting the error message with my custom domain-hosted app.
Hrm…Stefano’s app is using Full Python 3. Are the apps that aren’t working perhaps all using Python 3.10? (And specifically, using environments that haven’t been recreated recently?)
If you’re experiencing the problem on Python 3.10, can you try triggering a rebuild (eg by adding a pointless dependency like emoji), and see if that fixes the issue?
(The background here: This issue was caused by accidental version skew in an update: if you’ve got the new version of our server-side Python code and the update we just pushed, routing works fine, but if they’re mismatched then things break. We were too slow updating the server-side environments, hence this error being visible [our bad, sorry!]. However, we have now updated all Full Python environments, and we should have updated all Python 3.10 environments, but there seem to be some apps with the old code hanging about and I’m trying to work out [a] whether that’s true and [b] why.)
OK! The problem has been identified and fixed (a piece of deployment automation went wrong). I’ve started a rolling restart of all Python 3.10 server environments, which will eventually fix yours (the full process may take a couple of hours). If you want to force a restart sooner, change your requirements.
It seems to be partly fixed (Could I get more detail on the actual change). Here is the odd scenario I am in.
I have set these server routes to and printed encoded them into QR codes. When I attempt to look up that QR code using my mobile device, I get the following error: “Server with specified hostname could not be found”, but when I copy the URL from my mobile device to my laptop, the page is found.
Everything worked via mobile, previous to this issue. Not sure where to start looking.
UPDATE:
The urls encoded into the qr codes do not specify the transfer protocol. On my mobile device it defaults to http:// where in my laptop it defaults to https://
The update to server routes logic fails when it is not https.
I’m pretty sure that issue is independent of this thread (the change was in how FormResponse communicates its content back to the Anvil API server, which doesn’t touch https redirection at all - if the form can load, this machinery is working). I’d suggest starting another Q&A thread if you want help with this new issue. (But more than that, I’d suggest putting https:// on your URLs if you want them to work consistently; URLs without a protocol are not valid in QR codes!)
I resolved the issue! In the future I’ll be updating the QR codes to make them Valid. It was a phone specific problem with some extra security toggles I have on my person device.