question

pulse100 avatar image
pulse100 asked ·

Anyone had success with Java based Lambda function for ASK

Please let me know if anyone has had success running the Java samples from Amazon. In my case I am hitting a wall, here is my story..

OS: OS X 10.11.4

Installed Java 8 (Java SE 8u91 / 8u92)

Installed Maven : Maven 3.3.9

downloaded Java sample Repo: https://github.com/amzn/alexa-skills-kit-java

Followed all directions in the helloworld readme : https://github.com/amzn/alexa-skills-kit-java/blob/master/samples/src/main/java/helloworld/README.md

Was able to upload Jar file for the Lambda function and also configure the skill.

When I test the skill on the voice simulator I get the following response: The remote endpoint could not be called, or the response it returned was invalid.

Checked the logs and this is what I see.

com.amazon.speech.speechlet.SpeechletRequestHandlerException: Could not validate SpeechletRequest EdwRequestId.fde5a2dc-6fba-4912-a137-4d664a81a6bb using verifier ApplicationIdSpeechletRequestVerifier, rejecting request: java.lang.RuntimeException java.lang.RuntimeException: com.amazon.speech.speechlet.SpeechletRequestHandlerException: Could not validate SpeechletRequest EdwRequestId.fde5a2dc-6fba-4912-a137-4d664a81a6bb using verifier ApplicationIdSpeechletRequestVerifier, rejecting request at com.amazon.speech.speechlet.lambda.SpeechletRequestStreamHandler.handleRequest(SpeechletRequestStreamHandler.java:85) Caused by: com.amazon.speech.speechlet.SpeechletRequestHandlerException: Could not validate SpeechletRequest EdwRequestId.fde5a2dc-6fba-4912-a137-4d664a81a6bb using verifier ApplicationIdSpeechletRequestVerifier, rejecting request at com.amazon.speech.speechlet.SpeechletRequestHandler.handleSpeechletCall(SpeechletRequestHandler.java:63) at com.amazon.speech.speechlet.lambda.SpeechletRequestStreamHandler.handleRequest(SpeechletRequestStreamHandler.java:81)

The function in line 81 is:

@Override public final void handleRequest(InputStream input, OutputStream output, Context context) throws IOException { byte[] serializedSpeechletRequest = IOUtils.toByteArray(input); byte[] outputBytes; try { outputBytes = speechletRequestHandler.handleSpeechletCall(speechlet, serializedSpeechletRequest); } catch (SpeechletRequestHandlerException | SpeechletException ex) { throw new RuntimeException(ex); } output.write(outputBytes); }

Will really appreciate some help and direction.

skilljava
10 |2000 characters needed characters left characters exceeded

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

1 Answer

jjaquinta avatar image
jjaquinta answered ·

My steps to do it are here. It was written a while ago, but give you insight.

Really, what I think you need to do is turn off the stupid verification it does. You can see that in the

HelloWorldLambda function in that project.

10 |2000 characters needed characters left characters exceeded

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