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

ENDPOINT_TIMEOUT is not handled properly in Incorrect handling of SessionEndedRequest. #203

Open
mansisorathiya opened this issue Sep 21, 2022 · 0 comments

Comments

@mansisorathiya
Copy link

mansisorathiya commented Sep 21, 2022

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Expected Behavior

ENDPOINT TIMEOUT error should parse correctly.

if lambda(backend) takes too long to respond (> 50 seconds), Alexa will say "The requested skill took too long to respond" and send a SessionEndedRequest request to your skill with the error type set to ENDPOINT_TIMEOUT i.e:

{
	"version": "1.0",
	"session": {
		...
	},
	"context": {
		...
	},
	"request": {
		"type": "SessionEndedRequest",
		"requestId": "...",
		"timestamp": "...",
		"locale": "en-GB",
		"reason": "ERROR",
		"error": {
			"type": "ENDPOINT_TIMEOUT",
			"message": "An exception occurred while dispatching the request to the skill."
		}
	}
}

See alexa documentation of SessionEndedRequest which clearly mentions ENDPOINT_TIMEOUT as one of the possible types.

Current Behavior

Instead of this request being handled by the handler for SessionEndedRequest requests, the serializer.deserialize call to create a RequestEnvelope object will throw an error: SerializationException: ENDPOINT_TIMEOUT is not a valid SessionEndedErrorType.

Stack trace below


[ERROR] SerializationException: 'ENDPOINT_TIMEOUT' is not a valid SessionEndedErrorTypeTraceback (most recent call last):  File "/opt/python/ask_sdk_core/skill_builder.py", line 95, in wrapper    request_envelope = skill.serializer.deserialize(  File "/opt/python/ask_sdk_core/serialize.py", line 133, in deserialize    return self.__deserialize(payload, obj_type)  File "/opt/python/ask_sdk_core/serialize.py", line 194, in __deserialize    return self.__deserialize_model(payload, obj_type)  File "/opt/python/ask_sdk_core/serialize.py", line 312, in __deserialize_model    raise SerializationException(str(e)) | [ERROR] SerializationException: 'ENDPOINT_TIMEOUT' is not a valid SessionEndedErrorType Traceback (most recent call last):   File "/opt/python/ask_sdk_core/skill_builder.py", line 95, in wrapper     request_envelope = skill.serializer.deserialize(   File "/opt/python/ask_sdk_core/serialize.py", line 133, in deserialize     return self.__deserialize(payload, obj_type)   File "/opt/python/ask_sdk_core/serialize.py", line 194, in __deserialize     return self.__deserialize_model(payload, obj_type)   File "/opt/python/ask_sdk_core/serialize.py", line 312, in __deserialize_model     raise SerializationException(str(e))
-- | --

Steps to Reproduce (for bugs)

1. Configure custom lambda which is not hosted by alexa
2. Make sure lambda timeout configured is more than 60 seconds
3. Use  `time.sleep(60)` code to artificially introduce delay of 60 seconds.
4. Try invoking skill intent which hits code referenced in #3

Context

Logging what caused session to end for deep dive later.

Your Environment

  • ASK SDK for Python used: 3.9
  • Operating System and version: Lambda

Python version info

  • Python version used for development: 3.9

Similar issue got closed before : #64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant