Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verifyDomainDkim method of SES Client returns validation error #2880

Closed
onurkose opened this issue Feb 19, 2024 · 4 comments
Closed

verifyDomainDkim method of SES Client returns validation error #2880

onurkose opened this issue Feb 19, 2024 · 4 comments
Assignees
Labels
response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@onurkose
Copy link

onurkose commented Feb 19, 2024

Describe the bug

Documentation suggests using the method like this:

$result = $sesClient->verifyDomainDkim(['IdentityDomain' => 'example.com']);

Method's validation rule also expects IdentityDomain key to be exists.

The endpoint returns this error:

ValidationError (client): 1 validation error detected: Value null at 'domain' failed to satisfy constraint: Member must not be null

Expected Behavior

Returns the expected response such as:

{
    "DkimTokens": [
        "..."
    ]
}

Current Behavior

This is ok with the SDK validation:

$result = $sesClient->verifyDomainDkim(['IdentityDomain' => 'example.com']);

If I try passing only domain (as the error suggests) key:

$result = $sesClient->verifyDomainDkim(['domain' => 'example.com']);

then it throws this exception:

Found 1 error while validating the input provided for the VerifyDomainDkim operation:
[IdentityDomain] is missing and is a required parameter

I've also tried disabling SDK validation like this:

$client = new SesClient([
    'credentials' => ...,
    'region' => ...,
    'validate' => false,
]);

then it goes back to the beginning and returns the same error response:

ValidationError (client): 1 validation error detected: Value null at 'domain' failed to satisfy constraint: Member must not be null

Here are some logs from when debug mode was enabled:

-> Entering step build, name 'builder'
  ...
  request.body was set to Action=VerifyDomainDkim&Version=2010-12-01&IdentityDomain=example.com
  request.scheme was set to https

-> Entering step build, name 'ApiCallMonitoringMiddleware'

Reproduction Steps

  1. Create a domain identity (example.com) in AWS SES with any of the DKIM identity type (Easy or BYODKIM)
  2. First use aws cli to verify DKIM records: aws ses verify-domain-dkim --domain example.com --region us-east-1
  3. It will return a JSON response with the DkimTokens key.
  4. Then try the same with the AWS PHP SDK - SES Client's verifyDomainDkim method.

Possible Solution

No response

Additional Information/Context

In the meantime PHP SDK V2 and V3 documentation suggests using Domain as key when using this method.

SDK version used

aws-sdk-php 3.299.0 | aws/aws-sdk-php-symfony 2.7.0

Environment details (Version of PHP (php -v)? OS name and version, etc.)

PHP 8.2.9, MacOS 14.3.1, Env: Docker php:8.2-fpm-alpine

@onurkose onurkose added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 19, 2024
@yenfryherrerafeliz
Copy link
Contributor

Hi @onurkose, what I think that could be happening here is that for some reason your PHP SDK version is pinned to an older version where IdentityDomain was the expected parameter. The reason I think this is the issue is because in the current SDK version there is not a modeled parameter IdentityDomain for that operation, which we can confirm here in the input shape expected for this request. So there should not be a validation expecting that parameter, unless is an older version. There are different ways for confirming this:

  • You can try by deleting composer.lock and then run composer update. Then check if the issue persist
  • You can create an empty project from scratch and check if the issue persists there.
  • Try running composer show aws/aws-sdk-php | grep "versions :" and see if you are using an older version of the SDK.

Please make sure that when you do those tests you provided that parameter as 'Domain' and not 'domain'.

I look forward to your response.

Thanks!

@yenfryherrerafeliz yenfryherrerafeliz added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Feb 20, 2024
@yenfryherrerafeliz yenfryherrerafeliz self-assigned this Feb 20, 2024
@onurkose
Copy link
Author

It's so strange.
When I run the composer show command I receive the version as 3.299.0 and the line is like this:

'required' => [ 'IdentityDomain', ]

But even when I check the v3.299.0 tag, it's defined as Domain over there.

Deleting the lock file and composer update command fixed the issue.

Thanks a lot.

@yenfryherrerafeliz
Copy link
Contributor

@onurkose, you are very welcome. I do not know either why you got that behavior, but I am glad it is resolved now. Please open a new issue for anything else that we can help you with.

Thanks!

@yenfryherrerafeliz yenfryherrerafeliz removed the bug This issue is a bug. label Feb 20, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants