1

The Watson Speech-to-Text asynchronous HTTP interface allows one to register a callback url through a call to register_callback. This call is clearly not working; for illustration, please see these six lines of code.

# Illustration of how I can't get the Watson Speech-to-Text
# register_callback call to work.

r = requests.post(
    "https://stream.watsonplatform.net/speech-to-text/api/v1/register_callback?{0}".format(
        urllib.urlencode({ "callback_url": callback_url })),
    auth=(watson_username, watson_password),
    data="{}")

print(r.status_code)
print(pprint.pformat(r.json()))

# This outputs:

# 400
# {u'code': 400,
#  u'code_description': u'Bad Request',
#  u'error': u"unable to verify callback url 'https://xuyv2beqpj.execute-api.us-east-1.amazonaws.com/prod/SpeechToTextCallback' , server responded with status code: 400"}

# and no http call is logged on the server.

r = requests.get(
    callback_url, params=dict(challenge_string="what does redacted mean?"))

print(r.status_code)
print(r.text)

# This outputs:

# 200
# what does redacted mean?

# and an HTTP GET is logged on the server.

I first call register_callback with a perfectly valid callback_url parameter, in exactly the way the documentation describes. This call returns with a 400 and, according to my callback URL server logs, the callback URL never receives an HTTP request. Then I GET the callback URL myself with a challenge_string. Not only is the callback URL responding with the right output, but a log appears on my server indicating the URL received an HTTP request. I conclude that register_call is not working.

Adam Duston
  • 148
  • 2
  • 6

2 Answers2

0

Answer:

We identified the issue on our end: the server that makes the outbound calls to your URL did not support the SSL encryption method that your callback server uses. We have fixed that and we are in the process of pushing to the production environment very soon.

Also FYI:

The error message with 400 indicates the callback URL does not meet request or does not exist. Please refer to the detail in Speech-To-Text service API document, http://www.ibm.com/watson/developercloud/speech-to-text/api/v1/?curl#register_callback

If the service does not receive a response with a response code of 200 and a body that echoes a random alphanumeric challenge string from the callback URL within 5 seconds, it does not whitelist the URL; it sends response code 400 in response to the registration request.

joe
  • 2,468
  • 2
  • 12
  • 19
  • Thank you for opening the support ticket. Just tried the curl command; exactly the same result (as one would expect, since my python code makes exactly the same http request as the curl command). Not sure how this could have anything to do with a certificate chain. – Adam Duston Jul 04 '16 at 00:04
  • The example in the documentation uses http for the callback URL and yours uses https, so this might be causing an issue. – joe Jul 04 '16 at 00:05
  • Ah, got it. Just tried with http instead of https, same exact behavior. – Adam Duston Jul 04 '16 at 00:38
  • @AdamDuston Added support response. – joe Jul 05 '16 at 14:05
  • 1
    Hello Adam, I do see a callback verification failed on the logs regarding your URL. It happened yesterday, 2016-07-04 00:02:45,783, UTC time. I do see a 400 code in the logs, meaning that something went wrong when trying to verify the callback. I just tried myself directly against your URL and saw the following response: curl https://XXXXXXXX.amazonaws.com/prod/SpeechToTextCallBack {"message":"Missing Authentication Token"} -> "HTTP/1.1 403 Forbidden" , can you please check and let me know when your url is ready? I will try myself and check the pipeline, thank you – Daniel Bolanos Jul 05 '16 at 17:02
  • @daniel-bolanos I didn't provide the URL I used for callback because I didn't want to post it in a public forum -- hence the use of "" in my original post. But here it is: [https://xuyv2beqpj.execute-api.us-east-1.amazonaws.com/prod/SpeechToTextCallback](https://xuyv2beqpj.execute-api.us-east-1.amazonaws.com/prod/SpeechToTextCallback). AWS Lambda will respond to misspellings with the 403. Go ahead and try curling it (or just clicking) both with and without a challenge_string, and you'll see that it behaves exactly as expected. I'll edit post to reflect this. – Adam Duston Jul 06 '16 at 03:22
  • @DanielBolanos [Stack overflow modifies the text of the link in my reply comment](http://meta.stackexchange.com/a/91512) by inserting a `‌​`, so on my machine copying and pasting doesn't work. I recommend right-clicking to "Copy link address", since it stack overflow doesn't mutate the href. – Adam Duston Jul 06 '16 at 03:33
  • Hi Adam, no worries, I do have your URL, it is in the service logs. But I did not want to post it in a public board since I considered it sensitive information. We identified the issue on our end: the server that makes the outbound calls to your url did not support the SSL encryption method that your callback server uses. We have fixed that and we are in the process of pushing to the production environment very soon. – Daniel Bolanos Jul 06 '16 at 15:34
  • Adam, in the meantime I would like to ask you whether you use any sort of authentication mechanism on your callback server? This is what I'm seeing right now: "$ curl https://xuyv2beqpj.execute-api.us-east-1.amazonaws.com/prod/SpeechToTextCallbac‌​k?challenge_string=1234 {"message":"Missing Authentication Token"}" – Daniel Bolanos Jul 06 '16 at 15:34
  • Daniel, thank you for your help! About your missing authentication token, it looks like you copied and pasted the special unicode characters that Stack Overflow inserted (`‌​`); see my comment above. – Adam Duston Jul 06 '16 at 19:58
  • @DanielBolanos it looks like you guys have fixed this. Thanks again! Not sure if you want to make a StackOverflow answer that I can mark as correct; I can't accept the one we're commenting on since it's wrong. – Adam Duston Jul 06 '16 at 23:49
0

we just fixed the issue you reported. The problem was on our end, the servers responsible for making the callback to the server you set up did not support the cipher suites needed for establishing the SSL connection. We just updated the servers and we are happy to learn that it is now working for you: )

Dani

Daniel Bolanos
  • 770
  • 3
  • 6