Reputation: 41
I have the following problem:
1) I drop an image with the cloud storage console in a bucket.
2) From an app engine application I do getServingUrl and I recieve a working URL of the image.
Used code:
ImagesServiceFactory.getImagesService().getServingUrl(ServingUrlOptions.Builder.withGoogleStorageFileName(cloudStoragePath).secureUrl(true));
So far so good.
3) From an other app engine application I do also getServingUrl on the same image and now I get:
com.google.appengine.api.images.ImagesServiceFailureException:
at com.google.appengine.api.images.ImagesServiceImpl.ImagesService(ImagesServiceImpl.java:284)
When I first let the other application do getServingUrl it works fine in that application and now I get the exception in the other application. This is true for every image, so it may result that getServingUrl for some images works in one application (and stays working), while getServingUrl for other images (in the same bucket, with all the same rights) works in the other application. It depends on which application first called getServingUrl on that image.
Reading the image directly from the cloud storage always works in both applications.
Am I still doing something wrong? Or is this a bug?
Upvotes: 2
Views: 1369
Reputation: 8200
This is the App Engine Image API restriction. You can not serve an image from two or more separate applications.
If you serve images from Google Cloud Storage, you cannot serve an image from two separate apps. Only the first app that calls getServingUrl on the image can get the URL to serve it because that app has obtained ownership of the image. Any other app that subsequently calls getServingUrl on the image will therefore be unsuccessful. If a second app needs to serve the image, the app needs to first copy the image and then invoke getServingUrl on the copy. (The copy is deduped in storage.)
Upvotes: 1