question

dega1999 avatar image
dega1999 asked

Alexa Hosted Skill: persistence problems

Hi, I'm building a new skill in italian.

The code of the skill is this one:

https://pastebin.com/6LD9CPSU

I followed this link https://developer.amazon.com/docs/hosted-skills/build-a-skill-end-to-end-using-an-alexa-hosted-skill.html in order to use persistence on the skill (see: How do I use session persistence in an Alexa-hosted skill? )


But everytime I tests the 2 intents that use persistence, an error occurs.

On the log I have

on line 58 --> Error handled: Cannot get PersistentAttributes without PersistenceManager

or

on line 36 --> Cannot set PersistentAttributes without persistence adapter!


the package.json is

{
    "name": "hello-world",
    "version": "0.9.0",
    "description": "alexa utility for quickly building skills",
    "main": "index.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "Amazon Alexa",
    "license": "ISC",
    "dependencies": {
    "ask-sdk-core": "^2.0.7",
    "ask-sdk-model": "^1.4.1",
     "ask-sdk-s3-persistence-adapter": "^2.0.0",
    "aws-sdk": "^2.326.0"
    }
}


Any idea?


alexa skills kitalexahosted skill
10 |5000

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

dega1999 avatar image
dega1999 answered

Thanks you. It works now!


Now it's only on the bottom :)


exports.handler = Alexa.SkillBuilders.custom().withPersistenceAdapter(
    new persistenceAdapter.S3PersistenceAdapter({bucketName:process.env.S3_PERSISTENCE_BUCKET})
    )
    .addRequestHandlers(
        LaunchRequestHandler,
        AnnaffiatoIntentHandler,
        QuandoHoAnnaffiatoIntentHandler,
        HelpIntentHandler,
        CancelAndStopIntentHandler,
        SessionEndedRequestHandler,
        IntentReflectorHandler) // make sure IntentReflectorHandler is last so it doesn't override your custom intent handlers
    .addErrorHandlers(ErrorHandler)
    .lambda();


Happy friday!

1 comment
10 |5000

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

Thank you very much for your help!

0 Likes 0 ·
Amazon_Bernardo Bezerra avatar image
Amazon_Bernardo Bezerra answered

Hello @dega1999 and thanks for posting here in the forum.

By looking at the code you provided, I noticed that you are defining two different SkillBuilders, one on line 8 and another one on line 164. The second one (on line 164) is the one that usually comes with the templates and is the one that controls the way your code will interact to Alexa. There is where you should add your persistence adapter.

Let me know if this helps you.

I understand that the documentation is not clear on that and will reach out to the team responsible for it in order for have this addressed.

Regards,
Barry

10 |5000

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