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

"Unsupported media type" attempting to validate phone numbers with Pinpoint #84

Closed
cjsauer opened this issue Jun 29, 2019 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@cjsauer
Copy link

cjsauer commented Jun 29, 2019

Dependencies

com.cognitect.aws/api               {:mvn/version "0.8.305"}
com.cognitect.aws/endpoints         {:mvn/version "1.1.11.568"}
com.cognitect.aws/email             {:mvn/version "722.2.470.0"}
com.cognitect.aws/sns               {:mvn/version "718.2.444.0"}
com.cognitect.aws/pinpoint          {:mvn/version "711.2.411.0"}

Description with failing test case

I'm attempting to use Pinpoint's phone number validation endpoint, and can't seem to get a proper response.

(ns myapp.aws.pinpoint
  (:require [cognitect.aws.client.api :as aws]))

(def pinpoint
  (aws/client {:api :pinpoint}))

(aws/validate-requests pinpoint true)

(defn validate-phone-number
  [phone]
  (aws/invoke pinpoint
              {:op :PhoneNumberValidate
               :request {:NumberValidateRequest
                         {:PhoneNumber phone
                          :IsoCountryCode "US"
                          }}}))

(validate-phone-number "+14085550100")

Response:

{:message "Unsupported Media Type",
 :cognitect.anomalies/category :cognitect.anomalies/incorrect}

Looking at the request headers, it doesn't appear that the Content-Type header is present, but I'm unsure whether that is truly the root cause:

"x-amz-date" = "20190629T172118Z"
"host" = "pinpoint.us-east-1.amazonaws.com"
"authorization" = "AWS4-HMAC-SHA256 Credential=...

Amazon's example request appears to include that header.

@dchelimsky dchelimsky added the bug Something isn't working label Jul 1, 2019
@dchelimsky
Copy link
Contributor

Fixed in 5e1a88a.

@dchelimsky
Copy link
Contributor

Fixed in 0.8.335.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants