I use GCSService for writting file in a GoogleCloudStorage bucket, all works fine with online instance, but when I want to test my code on my local dev server, it's impossible to writte in a bucket (an emulate local bucket like for datastore). Additional difficulty I try to write on my local server with remote API from fat client, i search all around the web I doesn't find my answer. When I call my createOrUpdate() method I have this exception :
com.google.appengine.tools.cloudstorage.NonRetriableException: java.lang.RuntimeException: Server replied with 403, verify ACLs are set correctly on the object and bucket: Request: POST https://storage.googleapis.com/InstanceName/FileInfos
It's seem to try to write on my online bucket...
GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
...
RemoteApiOptions destination = RemoteConnection.connect(destinationServer);
RemoteApiInstaller destinationInstaller = new RemoteApiInstaller();
destinationInstaller.install(destination);
try
{
GcsOutputChannel outputChannel = gcsService.createOrReplace(new GcsFilename(destinationBucketServer, fileInfo.getFilename()),
GcsFileOptions.getDefaultInstance());
outputChannel.write(ByteBuffer.wrap(data));
outputChannel.close();
}
catch (Exception e)
{
....
}
finally
{
buffer.flush();
destinationInstaller.uninstall();
}
With same code I can write in DataStore without any problem, it's only a Storage issues.