serverless icon indicating copy to clipboard operation
serverless copied to clipboard

Could not locate deployment bucket. Error: Access Denied

Open bryanowen7 opened this issue 6 years ago • 7 comments

Bug Report

Description

  1. What did you do? I created a Serverless project and when I try to deploy it, I get the error: "Could not locate deployment bucket. Error: Access Denied"

  2. What happened? I get the error "Could not locate deployment bucket. Error: Access Denied"

  3. What should've happened? It should have deployed correctly and should have access to the bucket. I'm using the credentials of an account with Administrator access.

  4. What's the content of your serverless.yml file? `service: fel360-api

provider: name: aws runtime: nodejs12.x stage: v1 region: us-west-2 memorySize: 128 deploymentBucket: name: fel360-lambdas iamRoleStatements: - Effect: 'Allow' Action: - 'lambda:InvokeFunction' - 'ses:SendTemplatedEmail' - 'ses:SendRawEmail' - 's3:GetObject' - 's3:GetObjectAcl' - 's3:PutObject' - 's3:PutObjectAcl' - 's3:DeleteObject' - 's3:ListBucket' Resource: - '*'

package: excludeDevDependencies: false individually: true exclude: - '*/**'

functions: ${file(./serverless-config/functions.yml)}`

  1. What's the output you get when you use the SLS_DEBUG=* environment variable (e.g. SLS_DEBUG=* serverless deploy) `Serverless: Load command interactiveCli Serverless: Load command config Serverless: Load command config:credentials Serverless: Load command create Serverless: Load command install Serverless: Load command package Serverless: Load command deploy Serverless: Load command deploy:function Serverless: Load command deploy:list Serverless: Load command deploy:list:functions Serverless: Load command invoke Serverless: Load command invoke:local Serverless: Load command info Serverless: Load command logs Serverless: Load command metrics Serverless: Load command print Serverless: Load command remove Serverless: Load command rollback Serverless: Load command rollback:function Serverless: Load command slstats Serverless: Load command plugin Serverless: Load command plugin Serverless: Load command plugin:install Serverless: Load command plugin Serverless: Load command plugin:uninstall Serverless: Load command plugin Serverless: Load command plugin:list Serverless: Load command plugin Serverless: Load command plugin:search Serverless: Load command config Serverless: Load command config:credentials Serverless: Load command rollback Serverless: Load command rollback:function Serverless: Load command upgrade Serverless: Load command uninstall Serverless: Load command login Serverless: Load command logout Serverless: Load command generate-event Serverless: Load command test Serverless: Load command dashboard Serverless: Invoke deploy Serverless: Invoke package Serverless: Invoke aws:common:validate Serverless: Invoke aws:common:cleanupTempDir Serverless: Packaging service... Serverless: Invoke aws:package:finalize Serverless: Invoke aws:common:moveArtifactsToPackage Serverless: Invoke aws:common:validate Serverless: [AWS s3 403 0.579s 0 retries] getBucketLocation({ Bucket: 'fel360-lambdas' })

Serverless Error ---------------------------------------

ServerlessError: Could not locate deployment bucket. Error: Access Denied at BbPromise.resolve.then.then.catch.err (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\lib\existsDeploymentBucket.js:25:15) From previous event: at AwsDeploy.existsDeploymentBucket (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\lib\existsDeploymentBucket.js:24:13) at AwsDeploy.BbPromise.bind.then.then (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:73:27) From previous event: at Object.before:deploy:deploy [as hook] (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:70:12) at BbPromise.reduce (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:490:55) From previous event: at PluginManager.invoke (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:490:22) at getHooks.reduce.then (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:525:24) From previous event: at PluginManager.run (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:525:8) at variables.populateService.then (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:133:33) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) From previous event: at Serverless.run (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:120:74) at serverless.init.then (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\bin\serverless.js:75:30) at C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\node_modules\graceful-fs\graceful-fs.js:111:16 at C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\node_modules\graceful-fs\graceful-fs.js:45:10 at FSReqWrap.oncomplete (fs.js:135:15) From previous event: at initializeErrorReporter.then (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\bin\serverless.js:75:8) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) From previous event: at Object. (C:\Users\bryan\AppData\Roaming\npm\node_modules\serverless\bin\serverless.js:64:4) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Function.Module.runMain (module.js:694:10) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3

Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com

Your Environment Information --------------------------- Operating System: win32 Node Version: 8.12.0 Framework Version: 1.60.5 Plugin Version: 3.2.7 SDK Version: 2.2.1 Components Core Version: 1.1.2 Components CLI Version: 1.4.0`

bryanowen7 avatar Jan 14 '20 05:01 bryanowen7

@bryanowen7 if I see correctly you pointed the framework to use existing bucket named fel360-lambdas, and on deployment Framework reported that such bucket doesn't exist.

Are you sure that fel360-lambdas bucket exists in your AWS stack?

medikoo avatar Jan 14 '20 09:01 medikoo

Seems like it was using the wrong credentials due to a bad configuration on my end, it is now working, closed.

bryanowen7 avatar Jan 14 '20 16:01 bryanowen7

I have the same issue and verified that my credentials configured correctly. What did you have to change/correct?

triluong21 avatar Mar 24 '20 15:03 triluong21

I have the same issue and verified that my credentials configured correctly. What did you have to change/correct?

@triluong21 My credentials were actually correct, but I forgot to specify the profile to use in the serverless.yml file, basically you have to add profile: <profile name> to provider in your serverless.yml

bryanowen7 avatar Mar 24 '20 19:03 bryanowen7

@bryanowen7 It worked now. Thank you.

triluong21 avatar Mar 24 '20 21:03 triluong21

I was facing the same issue, noticed this was happening because i was trying to deploy locally using sls deploy from my machine ( rather than code build or other) and since I was passing --profile in the command but not in the serverless.yml provider therefore it was causing this issue.

Kindly try adding/setting profile in your serverless.yml under provider section and see if it works. @bryanowen7 Thanks.

akshaymishi avatar Sep 18 '20 02:09 akshaymishi

@bryanowen7 Thanks

Guilheeeerme avatar Sep 27 '21 00:09 Guilheeeerme