aws / aws-sdk-ruby

The official AWS SDK for Ruby.
https://aws.amazon.com/sdk-for-ruby/
Apache License 2.0
3.56k stars 1.22k forks source link

Validation Exception for valid Mturk Worker ID #2051

Closed railsvijay closed 5 years ago

railsvijay commented 5 years ago

Issue description

AssociateQualificationWithWorker API returning validation exception error for valid workerId

This worker already completed HITs before API Migration

And I noticed extra space added at the beginning of workerId in response. Is it for any length validation?

Gem name ('aws-sdk-mturk') and latest version

Version of Ruby, OS environment

ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]

Http wire trace

2019-05-17T13:53:59.021826+00:00 app[worker.1]: starting SSL for mturk-requester.us-east-1.amazonaws.com:443...
2019-05-17T13:53:59.023360+00:00 app[worker.1]: SSL established
2019-05-17T13:53:59.066792+00:00 app[worker.1]: <- "POST / HTTP/1.1\r\nContent-Type: application/x-amz-json-1.1\r\nAccept-Encoding: \r\nUser-Agent: aws-sdk-ruby3/3.48.4 ruby/2.3.7 x86_64-linux aws-sdk-mturk/1.12.0\r\nX-Amz-Target: MTurkRequesterServiceV20170117.AssociateQualificationWithWorker\r\nHost: mturk-requester.us-east-1.amazonaws.com\r\nX-Amz-Date: 20190517T135358Z\r\nX-Amz-Content-Sha256: 19cca6ecc4bab49dd4c38a29b94b114c9bd82a5361243bb32bcffbfd149ab306\r\nAuthorization: AWS4-HMAC-SHA256 Credential=AKIAJDZRPPERWJM7ZNCQ/20190517/us-east-1/mturk-requester/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=a06674fd38a8e95583b9a219867a3a3808132c18ae186d9b1642783cb4ffa889\r\nContent-Length: 101\r\nAccept: */*\r\nX-Newrelic-Id: VQ4BWFZUABABVlBRBgAGX1c=\r\nX-Newrelic-Transaction: PxRUV1ZTWQtUAFVbBwIHA1MHFB8EBw8RVU4aAQ4IBFMLAV1VCFEAUgEBAUNKQQkAUgYFUw9VFTs=\r\n\r\n"
2019-05-17T13:53:59.074801+00:00 app[worker.1]: -> "HTTP/1.1 400 Bad Request\r\n"
2019-05-17T13:53:59.074854+00:00 app[worker.1]: -> "x-amzn-RequestId: 9b676947-7ce4-4263-8559-2cd3a7a580d5\r\n"
2019-05-17T13:53:59.074898+00:00 app[worker.1]: -> "Content-Type: application/x-amz-json-1.1\r\n"
2019-05-17T13:53:59.074970+00:00 app[worker.1]: -> "Content-Length: 201\r\n"
2019-05-17T13:53:59.075609+00:00 app[worker.1]: -> "Date: Fri, 17 May 2019 13:53:58 GMT\r\n"
2019-05-17T13:53:59.077855+00:00 app[worker.1]: -> "Connection: close\r\n"
2019-05-17T13:53:59.077916+00:00 app[worker.1]: -> "\r\n"
2019-05-17T13:53:59.082921+00:00 app[worker.1]: reading 201 bytes...
2019-05-17T13:53:59.091866+00:00 app[worker.1]: -> ""
2019-05-17T13:53:59.101158+00:00 app[worker.1]: -> "{\"__type\":\"ValidationException\",\"message\":\"1 validation error detected: Value ' A6XFW3LMBFEVG' at 'workerId' failed to satisfy constraint: Member must satisfy regular expression pattern: ^A[A-Z0-9]+$\"}"
2019-05-17T13:53:59.102676+00:00 app[worker.1]: read 201 bytes
2019-05-17T13:53:59.102741+00:00 app[worker.1]: Conn close
2019-05-17T13:53:59.103211+00:00 app[worker.1]: [Aws::MTurk::Client 400 0.125687 0 retries] associate_qualification_with_worker(qualification_type_id:"3HKJJ33FJ52NWPLXP0NRT2J1VQ46KN",worker_id:" A6XFW3LMBFEVG",integer_value:1) Aws::MTurk::Errors::ValidationException 1 validation error detected: Value ' A6XFW3LMBFEVG' at 'workerId' failed to satisfy constraint: Member must satisfy regular expression pattern: ^A[A-Z0-9]+$
cjyclaire commented 5 years ago

Thanks for the wire trace! @railsvijay quick question, just double check, when making requests, the input parameter :worker_id doesn't include the extra space accidentally correct?

Once confirmed, happy to pass this question to service team for comments.

railsvijay commented 5 years ago

Ahh... Issue found before API call..