Re: ImagesService.getServingUrl returning old image with Google Cloud Storage

857 views
Skip to first unread message

Stuart Langley

unread,
Sep 17, 2012, 2:40:43 AM9/17/12
to google-a...@googlegroups.com
What's the image URL?

On Sunday, 16 September 2012 14:40:35 UTC+2, Tim wrote:
Hi,
I've just migrated one of our App Engine applications from Blobstore to Google Cloud Storage and am using the ImagesService.getServingUrl to serve images.
After uploading a new/changed image using a Google Cloud Storage name of an existing image, the ImagesService.getServingUrl still returns the old URL with the old image.
I also tried deleting the serving url using ImagesService.deleteServingUrl(blobKey), but that does not help either, even after calling the delete method, getServingUrl keeps returning the first image that was uploaded.
On Blobstore this was all working fine, so I was wondering whether deleteServingUrl should be working for Google Cloud Storage as well?

Thanks Tim

Tim

unread,
Sep 17, 2012, 4:03:23 AM9/17/12
to google-a...@googlegroups.com
The image url is: 

I currently use the ID of the datastore object for the GCS name, everytime I upload a new image using this same name the generated serving URL keeps serving the old image.

Nickolas Daskalou

unread,
Sep 17, 2012, 4:19:24 AM9/17/12
to google-a...@googlegroups.com
I can confirm we also have (or at least had) this issue.

In the end we bit the bullet and created timestamped copies of any file we updated in Google Cloud Storage, then used the serving URL of the timestamped version.

If I can find the URLs I'll send them through.

Nick


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/NGTV8FvXUgYJ.

To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.

Stuart Langley

unread,
Sep 18, 2012, 11:20:53 AM9/18/12
to google-a...@googlegroups.com
OK I just heard back from the team that runs this service.

1. If you change the file in Google Storage without changing the filename, then you'll need to do a  deleteServingURl/createServingURL for the file. Essentially when you createServingURL there is some work done to prepare your images for serving, and you'll need this work done again.

2. Even after doing step (1) the old image might remain in caches for up to 24 hours, and continue to be served.

We'll need to update out documentation for this. It seems if you want the image to be served immediately, you'll need it to have a new name.

Stuart Langley

unread,
Sep 18, 2012, 11:24:35 AM9/18/12
to google-a...@googlegroups.com
One more thing - Google storage is going to implement notifications when objects change, so we might be able to do step (1) automagically. 

Probably a feature request for that might be a good idea if you think it would be useful. 

Tim

unread,
Sep 18, 2012, 12:08:51 PM9/18/12
to google-a...@googlegroups.com
Thanks Stuart, our users upload (possibly changed) images through a web form and we want the (possibly changed) image to appear immediately after uploading (instead of a maximum of 24h) to prevent confusion. So for now I will make sure the images have unique names everytime they're changed.

I first was under the impression the deleteServingUrl wasn't implemented yet for GCS, since there is a separate API call for GCS:
ImagesService.getServingUrl(ServingUrlOptions.Builder.withGoogleStorageFileName(fullPath))
but the ImagesService.deleteServingUrl still uses the BlobKey (I know it's possible to transform a GCS path to a BlobKey)

Stuart Langley

unread,
Sep 18, 2012, 2:30:56 PM9/18/12
to google-a...@googlegroups.com
Just use the API to create a blobkey from a Cloud Storage filename and delete will work fine.

It should be possible to use a blobkey that points to a Cloud Storage file in any API that accepts a blobkey - e.g. serve(), images etc.

Tim Rob

unread,
Sep 18, 2012, 2:49:02 PM9/18/12
to google-a...@googlegroups.com
Thanks, I will keep that in mind.

Nickolas Daskalou

unread,
Sep 18, 2012, 11:58:39 PM9/18/12
to google-a...@googlegroups.com
Thanks for looking into this Stuart.

When you say "we might be able to do step (1) automagically", do you mean the GAE team will do this for us, or us app developers will need to do it? If it's the former, do we still need to submit a feature request?

Nick


To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/ePNdKns7ofsJ.

Stuart Langley

unread,
Sep 19, 2012, 11:16:00 AM9/19/12
to google-a...@googlegroups.com
-> submit feature request
Reply all
Reply to author
Forward
0 new messages