I’ve uploaded an image using replit object storage. I see the image in the object storage bucket on the server.
I have (what I think) is the accurate URL of the image, but I receive the error:
Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object. Permission ‘storage.objects.get’ denied on resource (or it may not exist).
I believe that replit set buckets to public on default, but possibly that needs set up somehow? I have not found anything in Replit documentation on this.
How do I access this image to show it on a page <img src"bla.jpg">
@kevin608 I asked Agent and got a response for you that I hope helps! Perhaps your Agent in your app might understand this? It does make sense. Essentially the app needs to display the object storage items through the app, not directly through the Google object link.
Replit Agent’s Pro Tip for Object Storage
Quick Implementation Guide for Them
They need to create an API route that:
Takes a file identifier as a parameter
Validates the request is for an allowed file
Uses the Replit Object Storage SDK to download the file
Serves it with proper headers (content-type, CORS, caching)
The key insight is that Replit Object Storage is meant to be accessed through your application’s API, not directly through public URLs. This is actually a more secure and flexible approach than direct file serving.
Would you mind sharing your code that is used to get the image and serve it in the API? I’ve spent hours with agent, an no luck so far to get it to display.
@kevin608 leery of sharing the code here for security, sorry, and it would likely be different than your exact use case, but after taking another look, what I can confirm here is that my app is using the ‘Object Storage JavaScript SDK’ outlined in the official Replit docs.
One thing I do recall is pasting the Replit doc URL (above) for this and other object storage related docs into Agent and asking it to implement the image to be visible in the app and publicly, since I needed the chatbot avatars to be publicly visible.