I am working on creating a practice Alexa skill and I am currently messing around with persistence. The skill basically has 2 user created intents. One, which saves a timestamp created at the time the intent is triggered. The second reads off the most recently created timestamp. Code snippets below. Here is my question, where is this information saved? In my testing I have confirmed that it works as intended, the data persists through multiple sessions and devices, but when I look at my S3 bucket (using the link from the code page in ASK console) it is showing as empty. Same for dynamodb, table is showing empty. My understanding, based on documentation, is that when a skill is Alexa hosted it saves persistent attributes in the associated S3 bucket but that is not what I am seeing. Where is this data staying? (TLDR it's working but according to what I'm seeing, it shouldn't)
Save intent (Please ignore illogical naming, I've been reusing intents for my learning):
const ReadIntentHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'ReadIntent';
},
handle(handlerInput) {
return new Promise((resolve, reject) => {
handlerInput.attributesManager.getPersistentAttributes()
.then((attributes) => {
var timeStamp = Date.now()
var date = new Date(timeStamp);
attributes.foo = date;
handlerInput.attributesManager.setPersistentAttributes(attributes);
return handlerInput.attributesManager.savePersistentAttributes();
})
.then(() => {
resolve(handlerInput.responseBuilder
.speak('Persistent attributes updated!')
.getResponse());
})
.catch((error) => {
reject(error);
});
});
}
};
Report Intent:
const HelloWorldIntentHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'HelloWorldIntent';
},
handle(handlerInput) {
return new Promise((resolve, reject) => {
handlerInput.attributesManager.getPersistentAttributes()
.then((attributes) => {
resolve(handlerInput.responseBuilder
.speak(attributes.foo)
.getResponse());
})
.catch((error) => {
reject(error);
});
});
}
};
Persistence Adapter:
function getPersistenceAdapter(tableName) {
// Determines persistence adapter to be used based on environment
// Note: tableName is only used for DynamoDB Persistence Adapter
if (process.env.S3_PERSISTENCE_BUCKET) {
// in Alexa Hosted Environment
// eslint-disable-next-line global-require
const s3Adapter = require('ask-sdk-s3-persistence-adapter');
return new s3Adapter.S3PersistenceAdapter({
bucketName: process.env.S3_PERSISTENCE_BUCKET,
});
}
// Not in Alexa Hosted Environment
return new ddbAdapter.DynamoDbPersistenceAdapter({
tableName: tableName,
createTable: true,
});
}
Empty Bucket

