Closed patrickbussmann closed 5 years ago
If you use the standard DynamoDB persistence the keys are named id
and attributes
, so you have to specify withDynamoDBPersistence('AlexaSkill', 'id', 'attributes');
.
In the example, I am remapping the names to match the ones from the SDK v1.
But thanks for the issue. I checked and indeed the defaults the tester uses were wrong too.
Fixed in 2.0.4
Ah ok. Thank you @hoegertn.
This testing isn't compatible with permissions, isn't it? Because I get this error:
Cannot read property 'scopes' of undefined
When I try the Amazon Pay
example. (https://developer.amazon.com/de/docs/amazon-pay/integrate-skill-with-amazon-pay-v2.html#check-for-amazon-pay-permissions-and-voice-purchase-settings)
const permissions = handlerInput.requestEnvelope.context.System.user.permissions;
const amazonPayPermission = permissions.scopes['payments:autopay_consent'];
if (amazonPayPermission.status === "DENIED") {
return handlerInput.responseBuilder
.speak('Please enable permission for Amazon Pay in your companion app.')
.withAskForPermissionsConsentCard(['payments:autopay_consent'])
.getResponse();
}
For myself I will check if it's not undefined
now. But maybe it is interesting for the future to test also this cases. If the user have permissions or not. Testing payment workflows, too. Or all things we can do with ASK SDK v2 👍
But this topic is closed now. Thank's for your answer. This is the final and working solution.
const alexaTest = new AlexaTest(skillHandler, skillSettings).withDynamoDBPersistence('AlexaSkill', 'id', 'attributes');
Description
I tried my skill with DynamoDB implementation. But it didn't worked like your example.
Steps to Reproduce
skill.spec.ts
index.ts
LaunchRequestHandler.ts Similar to example.
But I do it with a small saving interceptor.
Expected behavior:
No error occurs. The mockup have an empty object for the user or something similar.
Actual behavior:
An error occurs.
Environment
NodeJS-Version: v11.3.0
TypeScript-Version: 6.5.0
OS: Windows 10 Pro x64