alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

AccessDeniedException Error when calling householdlist API Code 403 #524

Closed lekanoni20 closed 5 years ago

lekanoni20 commented 5 years ago

Hi, When I try to create a list, i am starting to get the AccessDeniedException Error 403 and this only recently started to happen. Below is the full error code i get when trying to run the test event in AWS Lambda, 'x-amzn-errortype': 'AccessDeniedException:http://internal.amazon.com/coral/com.amazon.coral.service/', vary: 'Accept-Encoding,X-Amzn-CDN-Cache,User-Agent', 'x-cache': 'Error from cloudfront',

I was wondering if anyone else has had this issue recently or knows how to solve it ?

tianrenz commented 5 years ago

Hi @lekanoni20 ,

Could you verify that your skill has enabled HoustholdList api option in the skill developer console? and also that you grant the permission in the skill page in the alexa app?

Would you mind updating your issue using our issue template here? It will help investigate the problem.

Regards

lekanoni20 commented 5 years ago

If your talking about enabling the list read and write permissions in the skill developer console then yes i have. Also, the skill is still in development so it's not on the skill store yet. I'll use the issue template to elaborate on the issue.

lekanoni20 commented 5 years ago

name: AccessDeniedException Error when calling householdlist API Code 403 about: Issue with householdlist api in SDK


I'm submitting a...


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

When I try to create a list, i am starting to get the AccessDeniedException Error 403 and this only recently started to happen. Below is the full error code i get when trying to run the test event in AWS Lambda.

Expected Behavior

Should get the success code and the list should be created successfully. Success code 201 with the appropriate listId created.

Current Behavior

'x-amzn-errortype': 'AccessDeniedException:http://internal.amazon.com/coral/com.amazon.coral.service/', vary: 'Accept-Encoding,X-Amzn-CDN-Cache,User-Agent', 'x-cache': 'Error from cloudfront',

Possible Solution

Steps to Reproduce (for bugs)

const addNewListAction = function(context, callback) { console.log("prepare New List API call"); var path = "/v2/householdlists/"; console.log("path:" + path); var postData = { "name": "New List", //item value, with a string description up to 256 characters "state": "active" // item status (Enum: "active" only) };
const consentToken = context.System.apiAccessToken; console.log(consentToken) var options = { host: api_url, port: api_port, path: path, method: 'POST', headers: { 'Authorization': 'Bearer ' + consentToken, 'Content-Type': 'application/json' } }; var req = https.request(options, (res) => { console.log('statusCode:', res.statusCode); console.log('headers:', res.headers); var data = "";

    res.on('data', (d) => {
        console.log("data received:" + d);
        data += d;
    });
    res.on('error', (e) => {
        console.log("error received");
        console.error(e);
    });
    res.on('end', function() {
        console.log("ending post request");
        if (res.statusCode === 201) {
            var responseMsg = eval('(' + data + ')');
            console.log("new list id:" + responseMsg.listId);
            callback(res.statusCode, responseMsg.listId);
        } else {
            callback(res.statusCode, 0);
        }
    });
});
req.end(JSON.stringify(postData));

};

Context

Trying to create a list once a user triggers my createList Handler. Then once the list is created add, delete and update items from the list as well as read all the items from the list.

Your Environment

ASK SDK for Node.js used: Latest version in AWS Lambda Serverless Operating System and version: Windows 10

Node.js and NPM Info

Node.js version used for development: 8.10

lekanoni20 commented 5 years ago

Issue solved

wes1993 commented 3 years ago

@lekanoni20 hello, how you have solved the problem?