question

sugrsugr avatar image
sugrsugr asked

Error writing request body to server

I follow the instrutions on https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/reference-implementation-guide When "Running the Client", everything works fine until I reach step 16, and there is no response from server. Log message as follow: Sending 'POST' request to URL : https://access-alexa-na.amazon.com/v1/avs/speechrecognizer/recognize {"messageHeader":{"deviceContext":[{"name":"playbackState", "namespace":"AudioPlayer", "payload":{"streamId":"", "offsetInMilliseconds":"0", "playerActivity":"IDLE"}}]}, "messageBody":{"profile":"doppler-scone", "locale":"en-us", "format":"audio/L16; rate=16000; channels=1"}} java.util.concurrent.ExecutionException: java.io.IOException: Error writing request body to server at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at javax.swing.SwingWorker.get(SwingWorker.java:602) at com.amazon.alexa.avs.AVSApp$1$1.done(AVSApp.java:83) at javax.swing.SwingWorker$5.run(SwingWorker.java:737) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832) at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842) at javax.swing.Timer.fireActionPerformed(Timer.java:312) at javax.swing.Timer$DoPostEvent.run(Timer.java:244) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:738) at java.awt.EventQueue.access$300(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:699) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:708) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) Caused by: java.io.IOException: Error writing request body to server at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3205) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3188) at java.io.DataOutputStream.write(DataOutputStream.java:107) at com.amazon.alexa.avs.AudioCapture.captureAudio(AudioCapture.java:62) at com.amazon.alexa.avs.AVSController.startRecording(AVSController.java:62) at com.amazon.alexa.avs.AVSApp$1$1.doInBackground(AVSApp.java:76) at com.amazon.alexa.avs.AVSApp$1$1.doInBackground(AVSApp.java:73) at javax.swing.SwingWorker$1.call(SwingWorker.java:296) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at javax.swing.SwingWorker.run(SwingWorker.java:335) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
alexa voice service
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sugrsugr avatar image
sugrsugr answered
it works after a few retry.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sugrsugr avatar image
sugrsugr answered
<
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

swasey@amazon avatar image
swasey@amazon answered
You said it started working after a few retries. Did it continue to work every time after that, or was it spotty still and only working sometimes?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

vikram kaledhonkar avatar image
vikram kaledhonkar answered
I am getting exact same error as mentioned above when I try to run sample code given in reference implementation guide. As you can see, AVS returns a html response of 204. Can someone please help? I am just running the sample from Windows laptop with VLC. ====== Response Code : 204 Response Headers: null: [HTTP/1.1 204 No Content] x-amzn-ErrorType: [NoContentException: https://developer.amazon.com/edw/home.html] Vary: [Accept-Encoding,User-Agent] Date: [Tue, 15 Sep 2015 20:31:00 GMT] Content-Length: [0] x-amzn-RequestId: [ad120e1d-5be8-11e5-9b31-5fd41dfaf223] Connection: [keep-alive] Content-Type: [application/json] Server: [Server] Response : sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@5aae20b6 char set:UTF-8 response boundry:null java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252) at java.util.concurrent.FutureTask.get(FutureTask.java:111) at javax.swing.SwingWorker.get(SwingWorker.java:602) at com.amazon.alexa.avs.AVSApp$1$1.done(AVSApp.java:83) at javax.swing.SwingWorker$5.run(SwingWorker.java:737) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832) at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842) at javax.swing.Timer.fireActionPerformed(Timer.java:312) at javax.swing.Timer$DoPostEvent.run(Timer.java:244) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:701) at java.awt.EventQueue.access$000(EventQueue.java:102) at java.awt.EventQueue$3.run(EventQueue.java:662) at java.awt.EventQueue$3.run(EventQueue.java:660) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:671) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) at java.awt.EventDispatchThread.run(EventDispatchThread.java:97) Caused by: java.lang.NullPointerException at com.amazon.alexa.avs.AVSClient.finishRequest(AVSClient.java:164)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.