So, I’m trying to write a plugin that will push static assets into my S3 bucket, but i can’t seem to get permissions.
In my constructor, I have:
this.provider = this.serverless.getProvider('aws');
And in my command action, I use:
this.provider.request('S3', 'putObject', {...}, service.provider.stage, service.provider.region)
But I get:
ServerlessError: Access Denied
at Response.<anonymous> (.../server/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:168:20)
at Request.<anonymous> (.../server/node_modules/serverless/node_modules/aws-sdk/lib/request.js:355:18)
at Request.callListeners (.../server/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (.../server/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (.../server/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)
at Request.transition (.../server/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (.../server/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at .../server/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (.../server/node_modules/serverless/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (.../server/node_modules/serverless/node_modules/aws-sdk/lib/request.js:670:12)
at Request.callListeners (.../server/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
at Request.emit (.../server/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (.../server/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)
at Request.transition (.../server/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (.../server/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at .../server/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
Is there some stages or other things I should be doing to ensure this action works?