1
votes

Fatal error: Uncaught exception 'google\appengine\runtime\ApplicationError' with message 'The value of property "result" is longer than 1500 bytes.' in /base/data/home/runtimes/php/sdk/google/appengine/runtime/RealApiProxy.php:53 Stack trace: #0 /base/data/home/runtimes/php/sdk/google/appengine/runtime/ApiProxy.php(40): google\appengine\runtime\RealApiProxy->makeSyncCall('datastore_v4', 'Commit', Object(google\appengine\datastore\v4\CommitRequest), Object(google\appengine\datastore\v4\CommitResponse), 60) #1 /base/data/home/apps/s~apigraymatics/1.390460898442825180/public/data/GDS/Gateway/ProtoBuf.php(220): google\appengine\runtime\ApiProxy::makeSyncCall('datastore_v4', 'Commit', Object(google\appengine\datastore\v4\CommitRequest), Object(google\appengine\datastore\v4\CommitResponse), 60) #2 /base/data/home/apps/s~apigraymatics/1.390460898442825180/public/data/GDS/Gateway/ProtoBuf.php(101): GDS\Gateway\ProtoBuf->execute('Commit', Object(google\appengine\datastore\v4\CommitRequest), Object(google\appengine\datastore\v4\Com in /base/data/home/runtimes/php/sdk/google/appengine/runtime/RealApiProxy.php on line 53

My code is :

error_reporting(E_ALL);
ini_set('display_errors', 1);
include_once 'GDS/Entity.php';  
include_once 'GDS/Gateway.php'; 
include_once 'GDS/Store.php';  
include_once 'GDS/Schema.php'; 
include_once 'GDS/Mapper.php';  
include_once 'GDS/Gateway/ProtoBuf.php';  
include_once 'GDS/Mapper/ProtoBuf.php'; 
$obj = new GDS\Entity(); 
$obj_gateway_ns1 = new GDS\Gateway\ProtoBuf(null, '<namespace>');
$obj_store = new GDS\Store('<kind>', $obj_gateway_ns1);
$obj_schema = new GDS\Schema('<kind>');
$obj_schema->addString('transaction_id',FALSE);
$obj_schema->addString('result',FALSE);
$obj_schema->addString('image',FALSE);
$insert_data = array('transaction_id'=>'sbc','result'=>'1500byte','media_type'=>'image');
$obj = $obj_store->createEntity($insert_data);
$res = $obj_store->upsert($obj);
2

2 Answers

1
votes

I solve it after study GDS library

$obj = new GDS\Entity();
$obj_gateway_ns1 = new GDS\Gateway\ProtoBuf(null, 'name-space');
$obj_store = new GDS\Store('<kind-name>', $obj_gateway_ns1);
$obj_schema = new GDS\Schema('<kind-name>');
$obj_schema->addString('transaction_id');
$obj_schema->addString('result',FALSE);
$obj_schema->addString('image');
$obj_store = new GDS\Store($obj_schema, $obj_gateway_ns1);
$insert_data = array('transaction_id'=>'sbc','result'=>1500byte,'media_type'=>'image');
$obj = $obj_store->createEntity($insert_data);
$res = $obj_store->upsert($obj);

Thanks to Tom Walder for creating nice library

1
votes

I had a similar issue. I solved it using

.set(BINARY_DATA, BlobValue.of(Blob.copyFrom(getBinaryData())).excludeFromIndexes());

instead of

.set(BINARY_DATA, Blob.copyFrom(getBinaryData()));