DynamoDB Integration TypeError - SOLVED


#1

Hi all,
I am trying to use dynamodb but as soon as I require it in the code and create the new dynamoDB object I get an typeError. Is that related to a (non existing) user object?
Thanks, blueshep

Here the log form a start session test in lambda:

START RequestId: 1c298c44-5871-434e-a496-899fa81cb5e0 Version: $LATEST

2019-08-01T10:04:41.933Z 1c298c44-5871-434e-a496-899fa81cb5e0 INFO {
“version”: “1.0”,
“session”: {
“new”: true,
“sessionId”: “amzn1.echo-api.session.123456789012”,
“application”: {
“applicationId”: “amzn1.ask.skill.987654321”
},
“user”: {
“userId”: “amzn1.ask.account.testUser”
},
“attributes”: {}
},
“context”: {
“AudioPlayer”: {
“playerActivity”: “IDLE”
},
“System”: {
“application”: {
“applicationId”: “amzn1.ask.skill.987654321”
},
“user”: {
“userId”: “amzn1.ask.account.testUser”
},
“device”: {
“supportedInterfaces”: {
“AudioPlayer”: {}
}
}
}
},
“request”: {
“type”: “LaunchRequest”,
“requestId”: “amzn1.echo-api.request.1234”,
“timestamp”: “2016-10-27T18:21:44Z”,
“locale”: “de-DE”
}
}
2019-08-01T10:04:42.674Z 1c298c44-5871-434e-a496-899fa81cb5e0 INFO IN dev LAUNCH de-DE AlexaSkill

Error -----------------------------------------------------------------

Message:
Cannot convert undefined or null to object

Stack:
TypeError: Cannot convert undefined or null to object
at Function.values ()
at JovoUser.updateContextData (/var/task/node_modules/jovo-framework/dist/src/middleware/user/JovoUser.js:411:20)
at JovoUser.saveDb (/var/task/node_modules/jovo-framework/dist/src/middleware/user/JovoUser.js:118:22)
at Middleware.run (/var/task/node_modules/jovo-core/dist/src/Middleware.js:75:30)
at App.handle (/var/task/node_modules/jovo-core/dist/src/BaseApp.js:187:48)
at process._tickCallback (internal/process/next_tick.js:68:7)

Request details:
this.$alexaSkill initialized
this.$type: {“type”:“LAUNCH”}
this.$session.$data : {“user_platform”:“AlexaSkill”,“locale”:“de-DE”}
this.$nlu : undefined
this.$inputs : {}

2019-08-01T10:04:42.813Z 1c298c44-5871-434e-a496-899fa81cb5e0 ERROR Invoke Error {“errorType”:“TypeError”,“errorMessage”:“Cannot convert undefined or null to object”,“stack”:[“TypeError: Cannot convert undefined or null to object”," at Function.values ()"," at JovoUser.updateContextData (/var/task/node_modules/jovo-framework/dist/src/middleware/user/JovoUser.js:411:20)"," at JovoUser.saveDb (/var/task/node_modules/jovo-framework/dist/src/middleware/user/JovoUser.js:118:22)"," at Middleware.run (/var/task/node_modules/jovo-core/dist/src/Middleware.js:75:30)"," at App.handle (/var/task/node_modules/jovo-core/dist/src/BaseApp.js:187:48)"," at process._tickCallback (internal/process/next_tick.js:68:7)"]}
END RequestId: 1c298c44-5871-434e-a496-899fa81cb5e0
REPORT RequestId: 1c298c44-5871-434e-a496-899fa81cb5e0 Duration: 1129.61 ms Billed Duration: 1200 ms Memory Size: 128 MB Max Memory Used: 110 MB


#2

I found the problem: When I configure the user object in the config.js and I change the prev size I have to list all other prev settings no matter if they are the defaults.
Now the type error is gone.

user: {
    updatedAt: true,
    metaData: {
        enabled: true,
        requestHistorySize: 1000,
    },
    context: {
        enabled: true,
        prev: {
            size: 3000,
            request: {
                intent: true,
                state: true,
                inputs: true,
                timestamp: true,
            },
            response: {
                speech: true,
                reprompt: true,
                state: true,
                output: true,
            },
        },
    }
},