Skip to content

SES PHP API Error for createConfigurationSet(): [ConfigurationSet] is missing and is a required parameter

0

Hello,

I am trying to create an SES Configuration Set using the PHP API, however I am running into a "missing parameter" error.

Here is the code I am using:

$aws_Ses_client = new Aws\Ses\SesClient([
    'version' => '2010-12-01',
    'region' => 'us-east-1'
]);


$domain = 'mydomain.net';
try{
	$result = $aws_Ses_client->createConfigurationSet([   //// This is line 79
	    'ConfigurationSetName' => 'mydomain_net_for_12345678', // REQUIRED
	    'ReputationOptions' => [
	        'LastFreshStart' => time(),
	        'ReputationMetricsEnabled' => true,
	    ],
	    'SendingOptions' => [
	        'SendingEnabled' => true,
	    ],
	    'SuppressionOptions' => [
	        'SuppressedReasons' => ['COMPLAINT', 'BOUNCE'],
	    ],
	    'Tags' => [
	        [
	            'Key' => 'Program', // REQUIRED
	            'Value' => 'zzz User', // REQUIRED
	        ],
	        [
	            'Key' => 'zzz User ID', // REQUIRED
	            'Value' => '12345678', // REQUIRED
	        ]
	    ],
	    'TrackingOptions' => [
	        'CustomRedirectDomain' => 'click.'.$domain, // REQUIRED
	        'HttpsPolicy' => 'OPTIONAL',
	    ],
	    'VdmOptions' => [
	        'DashboardOptions' => [
	            'EngagementMetrics' => 'ENABLED',
	        ],
	        'GuardianOptions' => [
	            'OptimizedSharedDelivery' => 'ENABLED',
	        ],
	    ],
	]);
	var_dump($result);
} catch(AwsException $e){
	var_dump($e);
}

An HTTP500 error occurs, with the following error log entry being generated:

[04-Oct-2024] PHP Fatal error: Uncaught InvalidArgumentException: Found 1 error while validating the input provided for the CreateConfigurationSet operation: [ConfigurationSet] is missing and is a required parameter in /home/zzz/zzz.zzz.net/aws/vendor/aws/aws-sdk-php/src/Api/Validator.php:65 Stack trace: #0 /home/zzz/zzz.zzz.net/aws/vendor/aws/aws-sdk-php/src/Middleware.php(85): Aws\Api\Validator->validate('CreateConfigura...', Object(Aws\Api\StructureShape), Array) #1 /home/zzz/zzz.zzz.net/aws/vendor/aws/aws-sdk-php/src/IdempotencyTokenMiddleware.php(77): Aws\Middleware::Aws{closure}(Object(Aws\Command), NULL) #2 /home/zzz/zzz.zzz.net/aws/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(64): Aws\IdempotencyTokenMiddleware->__invoke(Object(Aws\Command)) #3 /home/zzz/zzz.zzz.net/aws/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(58): Aws\AwsClient->executeAsync(Object(Aws\Command)) #4 /home/zzz/zzz.zzz.net/aws/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(86): Aws\AwsClient->execute(Object(Aws\Command)) #5 /home/zzz/zzz.zzz.net/aws/awsTest.php(79): Aws\AwsClient->__call('createConfigura...', Array) #6 {main} thrown in /home/zzz/zzz.zzz.net/aws/vendor/aws/aws-sdk-php/src/Api/Validator.php on line 65

I have referenced the following docs: https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-sesv2-2019-09-27.html#createconfigurationset

https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_CreateConfigurationSet.html

I don't see any references to a parameter called ConfigurationSet, and a Google search of the error message does not seem return anything relevant.

Hoping that I just missed something and this is an easy one to solve, thanks in advance for any assistance you can offer!

asked 2 years ago190 views

1 Answer
1
Accepted Answer

The error you're encountering is due to a mismatch between the API version you're using and the parameters you're providing. The code you've shared is using the older SES API version ('2010-12-01'), but the parameters you're passing are more aligned with the newer SESv2 API.

To resolve this issue, you need to either:

  1. Update your SES client to use the newer SESv2 API:
$aws_Ses_client = new Aws\SesV2\SesV2Client([
'version' => '2019-09-27',
'region' => 'us-east-1'
]);
  1. Or, if you want to stick with the older API version, modify your createConfigurationSet call to match the expected parameters:
$result = $aws_Ses_client->createConfigurationSet([
'ConfigurationSet' => [
'Name' => 'mydomain_net_for_12345678'
]
]);

The older API expects a 'ConfigurationSet' parameter containing a 'Name' field, which explains the error message you're seeing. The newer SESv2 API, on the other hand, expects the parameters in the format you've provided in your code.

If you choose to update to the SESv2 API, make sure to update any other SES-related function calls in your code to match the new API's requirements. The SESv2 API provides more features and flexibility, so it's generally recommended to use it if possible.

Remember to install the appropriate SDK version that supports SESv2 if you decide to upgrade.
Sources
CreateConfigurationSet - Amazon Simple Email Service
Creating configuration sets in SES - Amazon Simple Email Service

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Yep, updating to V2 of the API was the solution, glad it was an easy fix! To whoever trained this AI, good job, it actually provided a useful answer!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.