Closed harristom closed 5 years ago
The deleteAttributes()
method is available in grater than 2.4.0.
You should replace your package.json like this.
"ask-sdk-core": "^2.6.0",
"ask-sdk-model": "^1.16.0",
"aws-sdk": "^2.326.0",
"ask-sdk-s3-persistence-adapter": "^2.6.0",
Tried that but still getting the same error. The method definitely exists because the error I get is that I don't have access to the item in S3.
On Fri, 31 May 2019 at 01:36, Hidetaka Okamoto notifications@github.com wrote:
The deleteAttributes() method is available in grater than 2.4.0. You should replace your package.json like this.
"ask-sdk-core": "^2.6.0", "ask-sdk-model": "^1.16.0", "aws-sdk": "^2.326.0", "ask-sdk-s3-persistence-adapter": "^2.6.0",
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/558?email_source=notifications&email_token=AMGXBDYL3RNVHHM32OOWUYTPYBQHZA5CNFSM4HRKCOKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWTZS2Q#issuecomment-497523050, or mute the thread https://github.com/notifications/unsubscribe-auth/AMGXBD56QYBGM4TKPOTKSV3PYBQHZANCNFSM4HRKCOKA .
Well...
Is the item not empty?
Probably, some S3 API throws Access Denied
error when the item not found in the S3 bucket.
Could you run the following code to reproduce the issue?
The code will create an S3 object before deleting the object. So It will work well.
const attributesManager = handlerInput.attributesManager;
attributesManager.setPersistentAttributes({
test: 'hello'
})
await attributesManager.savePersistentAttributes()
await attributesManager.deletePersistentAttributes();
The example will throw an Error from getPersistentAttributes
method.
Because the user's S3 object is already deleted.
const attributesManager = handlerInput.attributesManager;
attributesManager.setPersistentAttributes({
test: 'hello'
})
await attributesManager.savePersistentAttributes()
await attributesManager.deletePersistentAttributes();
try {
const item =await attributesManager.getPersistentAttributes()
console.log('Complete')
} catch (e) {
console.log(e)
console.log('actual')
}
We should use try ~ catch
to run the deletePersistentAttributes()
method.
Because sometime the S3 object is not found.
try {
await attributesManager.deletePersistentAttributes()
} catch (e) {
console.log(e)
}
I tried this and found the function through the error when using Hosted Skills, and did not throw an error if the function was running in my own AWS account.
How do you create the adaptor?
In Hosted skill, we need to set the process.env.S3_PERSISTENCE_BUCKET
param to bucketName.
Alexa.SkillBuilders.custom()
.withPersistenceAdapter(
new persistenceAdapter.S3PersistenceAdapter({
bucketName: process.env.S3_PERSISTENCE_BUCKET
})
)
Within the Alexa-hosted environment, you set bucketName
to the S3_PERSISTENCE_BUCKET value which is set by the Alexa-hosted environment to your S3 bucket name. To create the adapter outside of the Alexa-hosted environment, set bucketName
to the name of the bucket you want to store the data in (ensuring the function execution role has appropriate access to the bucket).
Hi @harristom @franklin-lobb ,
Thanks for reporting this bug. I reproduced the error you mentioned, but it's not our sdk side problem. Therefore, I need to reach out to host skill team to figure it out. Will inform you once I got their response.
Thanks, Shen
The service team started their work on this issue. Will update here once they fixed it.
@harristom @franklin-lobb
I think this issue has been fixed already. Could you please try and see if the problem still exist ?
Thanks, Shen
Close it for now, please feel free to reopen it if the problem still exist.
I'm submitting a...
Expected Behavior
I set/save some persistent attributes, then delete them
Current Behavior
Could not delete item (x) from bucket (y): Access Denied
Steps to Reproduce (for bugs)
Skill is Alexa Hosted Skill and attributes are successfully saved after using instructions here.
Trying to delete with:
Results in the error above
Your Environment
Alexa hosted skill