soto-project / soto

Swift SDK for AWS that works on Linux, macOS and iOS
https://soto.codes
Apache License 2.0
875 stars 83 forks source link

Tryint to call GetAccountSendingEnabled on SES and getting UnknownOperationException from AWS #580

Closed lordbarrison closed 2 years ago

lordbarrison commented 2 years ago

Describe the bug I'm just trying to make some simple calls to kick the tires on Soto. Here's a snippet of code

public func getSesSendingEnabled(account: String) async throws -> Bool {
    let ses = SES(client: self.clients[getAwsAccount(environment: account)]!, region: .uswest2)
    let response = try await ses.getAccountSendingEnabled()
    return response.enabled ?? false
  }

The self.clients is just a stash of pre-configured AWSClients and I've tested with S3 and I'm able to retrieve buckets successfully, so it feels like a problem with SES.

This response I get is this:

Unhandled error, code: notFound, body: <UnknownOperationException/>

I thought it might have needed an endpoint, so I tried the endpoint from here without luck: https://docs.aws.amazon.com/general/latest/gr/ses.html

To Reproduce Code above covers it.

Expected behavior I expect the call to work and return either true or false depending on the state of my account's SES.

Setup (please complete the following information):

Additional context Like I said, at least the call to fetch S3 buckets worked, so I know the client is good, creds are good (IAM permissions are wide open for now)

Thanks! Barry

adam-fowler commented 2 years ago

I believe this is being caused by an error in the creation of query style requests which have no body (they still need a body containing the service name and version). Most services don't care but obviously SES does. I will have a look at fixing this today.

adam-fowler commented 2 years ago

Can you update your packages so you have Soto-core 5.9.3 and test again

barryw commented 2 years ago

@adam-fowler I'm pulling in https://github.com/soto-project/soto.git. Has that been updated, or just soto-core?

adam-fowler commented 2 years ago

just Soto-core

barryw commented 2 years ago

Looks like Swift 5.6 just shipped and my XCode updated and now it won't compile soto because it was compiled with 5.5.2.

I'll get back to you.

adam-fowler commented 2 years ago

I've verified this as working so am going to close. If you are still having issues please re-open

barryw commented 2 years ago

@adam-fowler Thank you for fixing this so quickly!