diff --git a/samples/audiences/ingest_audience_members.php b/samples/audiences/ingest_audience_members.php index 688af87..3184901 100644 --- a/samples/audiences/ingest_audience_members.php +++ b/samples/audiences/ingest_audience_members.php @@ -227,8 +227,19 @@ function main( // Sets validate_only to true to validate but not apply the changes in the request. ->setValidateOnly(true); - // Creates a client for the ingestion service. - $client = new IngestionServiceClient(); + // [START create_client] + // Creates a client for the ingestion service. Increases the maximum metadata size to 16MB to + // prevent RESOURCE_EXHAUSTED errors when responses contain large error details. + $client = new IngestionServiceClient([ + 'transportConfig' => [ + 'grpc' => [ + 'stubOpts' => [ + 'grpc.max_metadata_size' => 16 * 1024 * 1024, + ], + ], + ], + ]); + // [END create_client] try { // Logs the request. echo "Request:\n" . json_encode(json_decode($request->serializeToJsonString()), JSON_PRETTY_PRINT) . "\n"; diff --git a/samples/events/ingest_events.php b/samples/events/ingest_events.php index 2527657..a181dc9 100644 --- a/samples/events/ingest_events.php +++ b/samples/events/ingest_events.php @@ -190,7 +190,18 @@ function main( ->setAccountId($linkedAccountId)); } - $client = new IngestionServiceClient(); + // Creates a client for the ingestion service. Increases the maximum metadata size to 16MB to + // prevent RESOURCE_EXHAUSTED errors when responses contain large error details. + $client = new IngestionServiceClient([ + 'transportConfig' => [ + 'grpc' => [ + 'stubOpts' => [ + 'grpc.max_metadata_size' => 16 * 1024 * 1024, + ], + ], + ], + ]); + try { $requestCount = 0; // Batches requests to send up to the maximum number of events per request.