Closed igilham closed 2 years ago
Fixing this bug is trivial but fixing the test suite is more complex.
The tests only exercise one type of RequestEnvelope
, a LaunchRequest
. There are several other types of requests which have different properties defined so there's quite a large gap in the test coverage for the core package of the SDK.
That wasn't quite correct. There's one mock but the tests modify it in-place to cover different types of requests. This seems a little fragile to me but it's a reasonable way to do it.
There is a missing test case for calling getSupportedInterfaces
with a request envelope with devices
undefined.
Please note that in my own testing, using strict
mode in Typescript makes this error impossible. It may be worth considering tighter compiler options to reduce this sort of thing in the future.
The utility function
getSupportedInterfaces
contains a TypeError for certain types of requests.https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/blob/ef6b97e9deaeb902856c33e570f56da8a2ff998a/ask-sdk-core/lib/util/RequestEnvelopeUtils.ts#L274
This code naïvely ignores whether or not the
device
field is defined, throwing the error for requests that do not include it.I've seen this cause a skill to crash in skill event (e.g.
AlexaSkillEvent.SkillEnabled
) and account linking (e.g.AlexaSkillEvent.SkillAccountLinked
) requests, which do not define thedevice
property.