alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

shouldEndSession is not a function #671

Open paul-uz opened 3 years ago

paul-uz commented 3 years ago

I am writing the handlers for Cancel and Stop, and I believe I should use shouldEndSession to close the session properly.

In the docs, http://ask-sdk-node-typedoc.s3-website-us-east-1.amazonaws.com/classes/responsebuilder.html#shouldendsession, it would appear I can add this to a response like so...

return handlerInput.responseBuilder
    .speak('Goodbye!')
    .shouldEndSession(true)
    .getResponse();

But, this results in the error shouldEndSession is not a function

There is an overwhelming lack of information about these wbuilt in intents, despite them being required for the most part.

Why am I getting this error, and how do I properly set shouldEndSession to true?

ShenChen93 commented 3 years ago

Hi @paul-uz ,

The function shouldEndSession is exported in ask-sdk-v1adapter package, which is used to help v1 SDK users to migrate to v2 SDK. For your case, you could use withShouldEndSession function exported in ask-sdk-core package, ref.

Let me know if it works for you :)

Thanks, Shen

paul-uz commented 3 years ago

Right.

Can you perhaps update your documentation then? As it is clearly wrong.

ShenChen93 commented 3 years ago

Hi @paul-uz ,

Sorry for responding late. Right now the api doc is autogenerated based on all the packages in our github repo. The tool we are using to generate the api doc is the typedoc. However, right now this tool has limitation on directory-based hierarchy. Thus class with same name but defined in diferrent modules will be combined into one page. While using this doc, people have to be careful whether the function is exported in correct module.

I'm sorry for the inconvenience, I will put this issue in our backlog.

Thanks, Shen

rahulawl commented 1 year ago

Is this issue/feature-request still relevant? We are working on prioritization of relevant issues and cleanup of rest. If we don’t hear back in 2 weeks, we will assume that the issue is not relevant and we will close it.

paul-uz commented 1 year ago

Yes it is still relevant. The documentation should reflect what the code is/does.