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

AskSdk.DynamoDbPersistenceAdapter Error: Could not read item #714

Open
leandrock opened this issue Apr 11, 2022 · 2 comments
Open

AskSdk.DynamoDbPersistenceAdapter Error: Could not read item #714

leandrock opened this issue Apr 11, 2022 · 2 comments
Labels

Comments

@leandrock
Copy link

leandrock commented Apr 11, 2022

I'm submitting a...


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

Expected Behavior

Current Behavior

Creating a new skill and using the code I allways use on other skills and cannot make the session attributes persist on dynamodb.

Relevant snippets from index.js:

const {DynamoDbPersistenceAdapter} = require('ask-sdk-dynamodb-persistence-adapter');
const { strict } = require('assert');
const persistenceAdapter = new DynamoDbPersistenceAdapter({ 
    tableName: 'table_name',
    createTable: true,
});
const LaunchRequestHandler = {
    canHandle(handlerInput) {
        return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest';
    },
    async handle(handlerInput) {
        const attributes = await persistenceAdapter.getAttributes(handlerInput.requestEnvelope);
        const sessionAttributes = handlerInput.attributesManager.getSessionAttributes();
...
        handlerInput.attributesManager.setSessionAttributes(sessionAttributes);
}

exports.handler = Alexa.SkillBuilders.custom()
    .addRequestHandlers(
        LaunchRequestHandler,
        CancelAndStopIntentHandler,
        SessionEndedRequestHandler,
        FallbackIntentHandler
    )
    .withPersistenceAdapter(persistenceAdapter)
    .addErrorHandlers(
        ErrorHandler,
    )
    .lambda();

Cloudwatch logs:

2022-04-11T14:20:07.845Z	03d7758b-fb01-4d7e-be9c-6bb921f340c7	INFO	~~~~ Error handled: AskSdk.DynamoDbPersistenceAdapter Error: Could not read item (amzn1.ask.account.AG2OPN...) from table (table_name): There were 227 validation errors:
* InvalidParameterType: Expected params.Key['id'] to be a structure
* UnexpectedParameter: Unexpected key '0' found in params.Key['id']
* UnexpectedParameter: Unexpected key '1' found in params.Key['id']
...
* UnexpectedParameter: Unexpected key '223' found in params.Key['id']
* UnexpectedParameter: Unexpected key '224' found in params.Key['id']
* InvalidParameterType: Expected params.getByIndex to be a string
    at Object.createAskSdkError (/var/task/node_modules/ask-sdk-runtime/dist/util/AskSdkUtils.js:22:17)
    at DynamoDbPersistenceAdapter.<anonymous> (/var/task/node_modules/ask-sdk-dynamodb-persistence-adapter/dist/attributes/persistence/DynamoDbPersistenceAdapter.js:123:46)
    at step (/var/task/node_modules/ask-sdk-dynamodb-persistence-adapter/dist/attributes/persistence/DynamoDbPersistenceAdapter.js:45:23)
    at Object.throw (/var/task/node_modules/ask-sdk-dynamodb-persistence-adapter/dist/attributes/persistence/DynamoDbPersistenceAdapter.js:26:53)
    at rejected (/var/task/node_modules/ask-sdk-dynamodb-persistence-adapter/dist/attributes/persistence/DynamoDbPersistenceAdapter.js:18:65)

Possible Solution

Steps to Reproduce (for bugs)

Context

Your Environment

  • ASK SDK for Node.js used: v2
  • Operating System and version: Windows 10

Node.js and NPM Info

  • Node.js version used for development: 12.X
  • NPM version used for development:
@doiron doiron added the bug label Apr 28, 2022
@rahulawl
Copy link
Contributor

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.

@jefforulez
Copy link

@leandrock did you use a newer version of the AWS SDK?

i just ran into and posted this issue: #726

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

No branches or pull requests

4 participants