{"action":"created","issue":{"url":"https://api.github.com/repos/alexa/alexa-skills-kit-sdk-for-java/issues/107","repository_url":"https://api.github.com/repos/alexa/alexa-skills-kit-sdk-for-java","labels_url":"https://api.github.com/repos/alexa/alexa-skills-kit-sdk-for-java/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/alexa/alexa-skills-kit-sdk-for-java/issues/107/comments","events_url":"https://api.github.com/repos/alexa/alexa-skills-kit-sdk-for-java/issues/107/events","html_url":"https://github.com/alexa/alexa-skills-kit-sdk-for-java/issues/107","id":320965970,"number":107,"title":"Some requests fail for AudioPlayer skill with no handler found","user":{"login":"Saandji","id":5137646,"avatar_url":"https://avatars3.githubusercontent.com/u/5137646?v=4","gravatar_id":"","url":"https://api.github.com/users/Saandji","html_url":"https://github.com/Saandji","followers_url":"https://api.github.com/users/Saandji/followers","following_url":"https://api.github.com/users/Saandji/following{/other_user}","gists_url":"https://api.github.com/users/Saandji/gists{/gist_id}","starred_url":"https://api.github.com/users/Saandji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saandji/subscriptions","organizations_url":"https://api.github.com/users/Saandji/orgs","repos_url":"https://api.github.com/users/Saandji/repos","events_url":"https://api.github.com/users/Saandji/events{/privacy}","received_events_url":"https://api.github.com/users/Saandji/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-07T21:34:03Z","updated_at":"2018-05-07T21:45:38Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nPLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.\r\nISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.\r\n-->\r\n## I'm submitting a Bug Report\r\n<!-- Check one of the following options with \"x\" -->\r\n<pre><code>[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[x] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ ] Performance issue\r\n[ ] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Other... Please describe:\r\n</code></pre>\r\n\r\n<!--- Provide a general summary of the issue in the Title above -->\r\n\r\nI've implemented the skill using this new SDK. The skill is using AudioPlayer interface. So far, the skill works without any issues, but everytime my skill gets invoked, I see that I have one execution of my Lambda function, which failes with error:\r\n\r\n`Unable to find a suitable request handler`\r\n\r\n## Expected Behavior\r\nI expect my skill to work without unexpected Exceptions, or at least have the meaninful error to be logged, so I can fix the issue. \r\n\r\n\r\n## Current Behavior\r\n\r\n<!--- If describing a bug, tell us what happens instead of the expected behavior -->\r\n<!--- Include full errors, uncaught exceptions, stack traces, and relevant logs -->\r\nCurrently, I get one Lambda execution with next logs:\r\n\r\nBefore I created the Exception handler:\r\n\r\n```\r\n2018-05-07 20:53:26 [ERROR] <b052c265-5238-11e8-803c-cb2b083b0db9> DefaultRequestDispatcher:97 - [amzn1.echo-api.request.b80e1411-524c-4811-812d-4905ed0bb6d3] Unable to find a suitable request handler\r\ncom.amazon.ask.exception.AskSdkException: [amzn1.echo-api.request.b80e1411-524c-4811-812d-4905ed0bb6d3] Unable to find a suitable request handler\r\nat com.amazon.ask.dispatcher.impl.DefaultRequestDispatcher.doDispatch(DefaultRequestDispatcher.java:98)\r\nat com.amazon.ask.dispatcher.impl.DefaultRequestDispatcher.dispatch(DefaultRequestDispatcher.java:68)\r\nat com.amazon.ask.Skill.invoke(Skill.java:87)\r\nat com.amazon.ask.Skill.invoke(Skill.java:62)\r\nat com.amazon.ask.SkillStreamHandler.handleRequest(SkillStreamHandler.java:67)\r\nat lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:888)\r\nat lambdainternal.AWSLambda.startRuntime(AWSLambda.java:283)\r\nat lambdainternal.AWSLambda.<clinit>(AWSLambda.java:64)\r\nat java.lang.Class.forName0(Native Method)\r\nat java.lang.Class.forName(Class.java:348)\r\nat lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:94)\r\n```\r\n\r\nafter I created the Exception interceptor trying to log something meaningful:\r\nthe interceptor code:\r\n```\r\nclass ExceptionLogHandler : ExceptionHandler {\r\n    private val log = KotlinLogging.logger {}\r\n    override fun canHandle(input: HandlerInput, throwable: Throwable): Boolean {\r\n        return true\r\n    }\r\n\r\n    override fun handle(input: HandlerInput, throwable: Throwable): Optional<Response> {\r\n        if (throwable is AskSdkException) {\r\n            log.error(\"Got SDK exception for input= ${objectMapper.writeValueAsString(input)}\")\r\n        } else {\r\n            log.error(\"An error occurred while processing the request for skillId=${input.skillId}\", throwable)\r\n        }\r\n        return input.responseBuilder\r\n                .withSpeech(getExceptionResponse(input.locale))\r\n                .build()\r\n    }\r\n\r\n    private fun getExceptionResponse(locale: String): String {\r\n        return \"some error message to the user here\"\r\n    }\r\n}\r\n```\r\nUnfortunately, it breaks to log the HandlerInput as json string with next message: \r\n```\r\n2018-05-07 21:13:07 [ERROR] <701d817b-523b-11e8-a1d7-41c0c74c0058> DefaultRequestDispatcher:97 - [amzn1.echo-api.request.7c7ae24a-bb8f-4933-b95e-bcc206aa319e] Unable to find a suitable request handler\r\nAttempting to read session attributes from out of session request (through reference chain: com.amazon.ask.dispatcher.request.handler.HandlerInput[\"attributesManager\"]->com.amazon.ask.attributes.AttributesManager[\"sessionAttributes\"]): com.fasterxml.jackson.databind.JsonMappingException\r\ncom.fasterxml.jackson.databind.JsonMappingException: Attempting to read session attributes from out of session request (through reference chain: com.amazon.ask.dispatcher.request.handler.HandlerInput[\"attributesManager\"]->com.amazon.ask.attributes.AttributesManager[\"sessionAttributes\"])\r\nat com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:391)\r\nat com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:351)\r\nat com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:316)\r\nat com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:727)\r\nat com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)\r\nat com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727)\r\nat com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719)\r\nat com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)\r\nat com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)\r\nat com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319)\r\nat com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3893)\r\nat com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3207)\r\nat com.saandji.alexa.audio.skill.handlers.exception.ExceptionLogHandler.handle(ExceptionLogHandler.kt:21)\r\nat com.amazon.ask.dispatcher.impl.DefaultRequestDispatcher.dispatch(DefaultRequestDispatcher.java:73)\r\nat com.amazon.ask.Skill.invoke(Skill.java:87)\r\nat com.amazon.ask.Skill.invoke(Skill.java:62)\r\nat com.amazon.ask.SkillStreamHandler.handleRequest(SkillStreamHandler.java:67)\r\nCaused by: java.lang.IllegalStateException: Attempting to read session attributes from out of session request\r\nat com.amazon.ask.attributes.AttributesManager.getSessionAttributes(AttributesManager.java:62)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\nat java.lang.reflect.Method.invoke(Method.java:498)\r\nat com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:687)\r\nat com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719)\r\n... 13 more\r\n```\r\n\r\n\r\n<!--- If service responses are relevant, please include any -->\r\nnot sure for the question above\r\n\r\n\r\n<!--- If suggesting a change/improvement, explain the difference from current behavior -->\r\nI would expect the SDK to log the error and tell me what kind of Handler it is expect to see if the Handler was not found. At least the request type or some more meaninful information. \r\n\r\n## Steps to Reproduce (for bugs)\r\n\r\nI will follow up this Issue, if you will need my help to reproduce the bug, i can share the code privately, with you for debugging/root causing.\r\n\r\n```\r\n// Provide a self-contained, concise snippet of code\r\n// For more complex issues provide a repo with the smallest sample that reproduces the bug\r\n// Including business logic or unrelated code makes diagnosis more difficult\r\n```\r\n\r\n## Possible Solution\r\n\r\nN/A at the moment\r\n\r\n```\r\n// Not required, but suggest a fix/reason for the bug,\r\n// or ideas how to implement the addition or change\r\n```\r\n\r\n## Context\r\n<!--- How has this issue affected you? What are you trying to accomplish? -->\r\nThe issue effected me in the way, that I am not sure that the skill handles all required requests from Alexa, since it is working just fine, but I constantly see these errors in CloudWatch.\r\n\r\n<!--- Providing context helps us come up with a solution that is most useful in the real world -->\r\n\r\nthis is the list of my handlers: I won't publish the whole implementation here, but the class names reflect the RequestType coming from Alexa.\r\n\r\n```kotlin\r\n //audio\r\n                        OnPlaybackFailedRequestHandler(),\r\n                        OnPlaybackStartedRequestHandler(),\r\n                        OnPlaybackNearlyFinishedRequestHandler(),\r\n                        OnPlaybackFinishedRequestHandler(),\r\n                        OnPlaybackStoppedRequestHandler(),\r\n                        OnPlayCommandIssuedRequestHandler(),\r\n                        OnNextCommandIssuedRequestHandler(),\r\n                        OnPauseCommandIssuedRequestHandler(),\r\n                        OnPreviousCommandIssuedRequestHandler(),\r\n\r\n                        //default\r\n                        LaunchRequestHandler(),\r\n                        //custom handler to handle all my custom audio intents, not relevant for this bug\r\n                        AudioIntentsRequestHandler(), \r\n                        SessionEndedRequestHandler(),\r\n                        CancelStopPauseIntentsHandler(),\r\n                        HelpIntentHandler())\r\n```\r\n\r\n## Your Environment\r\n<!--- Include as many relevant details about the environment where the bug was discovered -->\r\nJava: 1.8\r\nKotlin: 1.2.41\r\nLambda environment\r\nAsk SDK version: 2.0.2\r\n\r\n\r\n## Java Info\r\n<!--- For Java issues, please provide the following -->\r\n* Java version used for development: 1.8\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/alexa/alexa-skills-kit-sdk-for-java/issues/comments/387216787","html_url":"https://github.com/alexa/alexa-skills-kit-sdk-for-java/issues/107#issuecomment-387216787","issue_url":"https://api.github.com/repos/alexa/alexa-skills-kit-sdk-for-java/issues/107","id":387216787,"user":{"login":"Saandji","id":5137646,"avatar_url":"https://avatars3.githubusercontent.com/u/5137646?v=4","gravatar_id":"","url":"https://api.github.com/users/Saandji","html_url":"https://github.com/Saandji","followers_url":"https://api.github.com/users/Saandji/followers","following_url":"https://api.github.com/users/Saandji/following{/other_user}","gists_url":"https://api.github.com/users/Saandji/gists{/gist_id}","starred_url":"https://api.github.com/users/Saandji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saandji/subscriptions","organizations_url":"https://api.github.com/users/Saandji/orgs","repos_url":"https://api.github.com/users/Saandji/repos","events_url":"https://api.github.com/users/Saandji/events{/privacy}","received_events_url":"https://api.github.com/users/Saandji/received_events","type":"User","site_admin":false},"created_at":"2018-05-07T21:45:38Z","updated_at":"2018-05-07T21:45:38Z","author_association":"NONE","body":"So I managed to log the Request object in my ExceptionHandler. Here's the request, unfortunately I'm not sure how it is possible to get error \"SpeechletResponse was null\", since I'm passing the Optional everywhere\r\n\r\n```json\r\n{\r\n    \"type\": \"System.ExceptionEncountered\",\r\n    \"requestId\": \"amzn1.echo-api.request.3155b930-f6c2-455b-8bf5-e045fde9008d\",\r\n    \"timestamp\": {\r\n        \"offset\": {\r\n            \"totalSeconds\": 0,\r\n            \"id\": \"Z\",\r\n            \"rules\": {\r\n                \"transitions\": [\r\n                    \"java.util.ArrayList\",\r\n                    []\r\n                ],\r\n                \"transitionRules\": [\r\n                    \"java.util.ArrayList\",\r\n                    []\r\n                ],\r\n                \"fixedOffset\": true\r\n            }\r\n        },\r\n        \"year\": 2018,\r\n        \"month\": \"MAY\",\r\n        \"dayOfMonth\": 7,\r\n        \"dayOfWeek\": \"MONDAY\",\r\n        \"dayOfYear\": 127,\r\n        \"monthValue\": 5,\r\n        \"hour\": 21,\r\n        \"minute\": 42,\r\n        \"nano\": 0,\r\n        \"second\": 33\r\n    },\r\n    \"locale\": \"en-US\",\r\n    \"error\": {\r\n        \"type\": \"INVALID_RESPONSE\",\r\n        \"message\": \"SpeechletResponse was null\"\r\n    },\r\n    \"cause\": {\r\n        \"requestId\": \"amzn1.echo-api.request.5ac913ab-9d55-4a4c-bc9e-415e795c36a1\"\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"Saandji"}}