[FIXED] Problem serving LazyMedia over HTTP

What I’m trying to do:

Set up row ID URLs for image files in a data table so they can be transmitted over HTTP, worked fine until this morning, now I get exceptions telling me I cannot transmit LazyMedia objects over HTTP. Do I have to add a transform onto the object before it gets sent?

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

Tried getBytes() method on LazyMedia object but getting errors on serializing into the response body. Not sure that this is the right path to go down anyway.

Code Sample:

def get_image(row_id, **p):
  row = app_tables.business_media.get_by_id(row_id)
  print(row_id)
  print(row)
  print(row['file'])

  if row is not None:
    # Returning a Media object serves it as the HTTP response
    print('row considered to exist')
    return row['file']
  else:
    print('row considered not to exist')
    return anvil.server.HttpResponse(status='404')

So without having to go back through and re-code how I upload images and generate new URLs for all my current assets or whatever the new right way is I am at a loss, cannot currently serve media to the front end of my app. Does stopping LazyMedia from being servable over HTTP achieve some benefit for us?

Help here would be much appreciated.

Thanks,

James

For the record, it looks like using the .url() method isn’t going to be appropriate as its a download link and not a served image URL. I need to be able to get network images to my mobile app - is there still a way to do this?

Thanks for letting us know - we’re investigating and will get back to you. (moved to bug reports)

thanks - not sure if its related but just before this started happening I started getting exceptions thrown by my APIs telling me:

anvil.server.RuntimeUnavailableError: Downlink disconnected

Which seems to be something other users have been experiencing recently - its a first for me and very worrying.

That should now be fixed - please let us know if that’s not the case.

seems to be working now thanks