We use the generated SDK from API Gateway to interface between our iOS app and our API. This was working well until I fetched the latest aws-sdk-ios commit a few minutes ago. We did a little digging, and it seems like the requests are now malformed. For instance, instead of hitting our endpoint /v1/users/{id} with the id populated, the SDK is trying to hit /v1/users/%7Bid%7D (the URL-encoded string 'id'). Maybe a small URL decoding bug somewhere?
Hi,
Thanks for reporting the issue. We are looking into it. In the meanwhile, could you please set the iOS SDK version to 2.4.9? The generated SDK should work fine with iOS SDK version 2.4.9.
Thanks,
Rohan
Hi @rainypixels , could you please provide with some steps to reproduce this issue?
I was not able to reproduce it on my side.
Thanks,
Rohan
@rohandubal Thanks! I rolled back to 2.4.9, and I can confirm that it works.
As for repro steps, I'll do my best to try to explain. Some background:
aws-ios-sdk 2.4.10, we started seeing 404s for any calls to generated SDK methods that employ query parameters. With that in mind, here's an example of one such issue. We have a method that gets all the details for a user. It accepts one argument: id (a String type):
static func userDetails(_ id: String, completionHandler: @escaping CompletionHandler) {
DIGClient.default() // the default client for the generated SDK
.usersIdGet(id) // the method from the generated SDK
.continue ({ (task) -> Any? in
if let result = task.result as? JSONDictionary {
do {
// unbox user
let response: UserDetailsResponse = try unbox(dictionary: result)
// return it
Async.main {
completionHandler(response.data.user, nil)
}
} catch {
Async.main {
completionHandler(nil, (error as? UnboxError)?.description)
}
}
} else if let error = task.error {
Async.main {
// pass back error
completionHandler(nil, error)
}
}
return nil
})
}
2.4.9, everything works as expected. However in 2.4.10, this call always reaps a 404. Upon investigation in our logs, we see that the call fails far before it hits our API. It fails at the gateway level because the generated SDK method tries to hit the endpoint https://it1mbcb8ba.execute-api.us-west-2.amazonaws.com/dev/v1/users/%7Bid%7D instead of https://it1mbcb8ba.execute-api.us-west-2.amazonaws.com/dev/v1/users/us-east-1:edad890a-cbf6-468b-8062-9ea07c35fd00. Effectively, string interpolation for the id parameter seems to fail somewhere downstream from the method call in our iOS app.Happy to give you our API Gateway ID, or more info if that helps. Thanks for looking into this!
Thank you @rainypixels , your response was helpful and helped me reproduce the issue. We will have a fix for it soon and update this thread once its available.
Hi,
This issue is fixed with 2.4.11. The only affected SDK version was 2.4.10.
Thanks,
Rohan
Not fixed - please see #505
Most helpful comment
Thank you @rainypixels , your response was helpful and helped me reproduce the issue. We will have a fix for it soon and update this thread once its available.