alexa / ask-toolkit-for-vscode

ASK Toolkit is an extension for Visual Studio Code (VSC) that that makes it easier for developers to develop and deploy Alexa Skills.
https://developer.amazon.com/en-US/docs/alexa/ask-toolkit/get-started-with-the-ask-toolkit-for-visual-studio-code.html
Apache License 2.0
109 stars 53 forks source link

local debugging of skills using persistent storage not working #259

Open voco-dev opened 1 year ago

voco-dev commented 1 year ago

Desktop (please complete the following information):

Question persistent storage not working with local debugging.

when i run the skill in the console it works fine. i download the alexa-hosted-skill code, start the debugger with no issues. when i invoke the skill with an intent that tries to read from the s3 storage i get the following error:



when i try an intent that uses dynamodb, i get this error:
~~~ Error handled: AskSdk.DynamoDbPersistenceAdapter Error: Could not read item (amzn1.ask.account......) from table (undefined): Missing required key 'TableName' in params

is this expected behavior that we would not be able to locally debug skills that use any persistent storage?

these look like things set in env variables for lambda, so perhaps i am missing a setting somewhere???
tydonelson commented 1 year ago

Thanks for reporting @voco-dev ! We'll take a look into how this could be supported.

To make sure we're getting as close to your use case as possible, do you have a snippet (with any sensitive info redacted) from your lambda that illustrates how you're reading from s3 storage?

voco-dev commented 1 year ago

I was pretty much following the documentation. My code just retrieves the file from s3 using axios

... const fileUrl = this.getS3PreSignedUrl("Media/menu-data.json"); try { const res = await Axios.get(fileUrl); ...

the example code from hello world util.js:

const s3SigV4Client = new AWS.S3({ signatureVersion: 'v4', region: process.env.S3_PERSISTENCE_REGION });

module.exports.getS3PreSignedUrl = function getS3PreSignedUrl(s3ObjectKey) {

const bucketName = process.env.S3_PERSISTENCE_BUCKET;
const s3PreSignedUrl = s3SigV4Client.getSignedUrl('getObject', {
    Bucket: bucketName,
    Key: s3ObjectKey,
    Expires: 60*1 // the Expires is capped for 1 minute
});
console.log(`Util.s3PreSignedUrl: ${s3ObjectKey} URL ${s3PreSignedUrl}`);
return s3PreSignedUrl;

}

error is:

tydonelson commented 1 year ago

Thanks for the additional info!