I am getting following error when run serverless deploy -v
Serverless Error ---------------------------------------
Missing required key 'Bucket' in params
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Your Environment Infomation -----------------------------
OS: win32
Node Version: 6.3.0
Serverless Version: 1.0.0
Current serverless.yml
service: api
provider:
name: aws
runtime: nodejs4.3
stage: prod
region: us-west-2
credentials:
accessKeyId: accessKeyIdhere
secretAccessKey: secretAccessKeyhere
functions:
hello:
handler: handler.hello
events:
- http:
path: hello/test
method: get
I am not using anything related bucket than why i need to setup bucket key ?
hmmm @nirmalgoswami I'm unable to reproduce this. could you run export SLS_DEBUG=* in your service directory, and deploy again? Just wanna take a look at the stack trace if the error happens again.
@nirmalgoswami have you reused an old service which ran on rc2 or earlier previously?
@pmuens no, I was using version v0.5 now i am going to use v1.0 . you can see my code i have did not started real developmenet yet this is just default function which i am trying to deploy. so my answer is no i am not using old service.
v0.5 is very different. For this config, please use v1 馃槉
@eahefnawy ya i am using v1 right now.this is related to the v1. in between how to run export SLS_DEBUG=* in windows :)
@eahefnawy i got it its an environment variable i.e. SLS_DEBUG=*
here is trace
Serverless Error ---------------------------------------
Missing required key 'Bucket' in params
Stack Trace --------------------------------------------
ServerlessError: Missing required key 'Bucket' in params
at Response.req.send (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\index.js:137:20)
at Request.<anonymous> (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\request.js:355:18)
at Request.callListeners (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\sequential_executor.js:105:20)
at Request.emit (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\sequential_executor.js:77:10)
at Request.emit (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\request.js:668:14)
at Request.transition (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\state_machine.js:14:12)
at C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\request.js:38:9)
at Request.<anonymous> (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\request.js:670:12)
at Request.callListeners (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\sequential_executor.js:115:18)
at Request.emit (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\sequential_executor.js:77:10)
at Request.emit (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\request.js:668:14)
at Request.transition (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\state_machine.js:14:12)
at C:\Users\test\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\state_machine.js:26:10
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Your Environment Infomation -----------------------------
OS: win32
Node Version: 6.3.0
Serverless Version: 1.0.0
I got issue,i can replicate issue now.
Don't give AdministratorAccess rights before serverless deploy -v
Note : I know that we need AdministratorAccess but i want to give minimal permission so i was checking
than give rights AdministratorAccess after that you can replicate issue after run serverless deploy -v
It should be not like that. may be in some case we can not create service in aws than it should work after require fix i.e. assign admin rights because previous operation was not complete. serverless deploy -v should work after number of issue while doing deploy . user can fix issue while doing deploy. if this will not fix than we need to change service name every time when we got any issue during serverless deploy -v
Let me know what i have remove to manually from aws console becasue i want to use word api for service name.right now i cant make service called api due to this issue
I'm also experiencing the originally reported issue.
I tried giving my IAM user the AdministratorAccess policy, but I still get the same error:
Serverless: Packaging service...
Serverless Error ---------------------------------------
Missing required key 'Bucket' in params
Stack Trace --------------------------------------------
ServerlessError: Missing required key 'Bucket' in params
at Response.req.send (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/lib/plugins/aws/index.js:137:20)
at Request.<anonymous> (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:355:18)
at Request.callListeners (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)
at Request.transition (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:670:12)
at Request.callListeners (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
at Request.emit (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)
at Request.transition (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:35:11)
at Request.<anonymous> (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:670:12)
at Request.callListeners (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
at callNextListener (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:95:12)
at /nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/event_listeners.js:75:9
at finish (/nvm/versions/node/v6.8.1/lib/node_modules/serverless/node_modules/aws-sdk/lib/config.js:307:7)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Your Environment Infomation -----------------------------
OS: darwin
Node Version: 6.8.1
Serverless Version: 1.0.2
My serverless.yml is very simple right now:
# ...
provider:
name: aws
runtime: nodejs4.3
plugins:
- serverless-webpack
- serverless-plugin-write-env-vars
# ...
I was able to resolve this by deleting the stack in the AWS console and re-deploying with Serverless.
The issue was that my IAM profile didn't have some necessary permissions when I did the initial deploy, causing stack creation/rollback to fail. So the stack was left in a broken state on AWS.
I reproduced this issue. It occurred because of a stack failure. The stack log in reverse chronological order follows. I will follow the listing with a description of how I got into the state.
00:46:48 UTC-0700 ROLLBACK_COMPLETE AWS::CloudFormation::Stack serverless-artillery-BkhEK9uJg-dev
00:46:47 UTC-0700 DELETE_COMPLETE AWS::S3::Bucket ServerlessDeploymentBucket
00:46:37 UTC-0700 ROLLBACK_IN_PROGRESS AWS::CloudFormation::Stack serverless-artillery-BkhEK9uJg-dev The following resource(s) failed to create: [ServerlessDeploymentBucket]. . Rollback requested by user.
00:46:36 UTC-0700 CREATE_FAILED AWS::S3::Bucket ServerlessDeploymentBucket You have attempted to create more buckets than allowed
00:46:35 UTC-0700 CREATE_IN_PROGRESS AWS::S3::Bucket ServerlessDeploymentBucket
00:46:30 UTC-0700 CREATE_IN_PROGRESS AWS::CloudFormation::Stack serverless-artillery-BkhEK9uJg-dev User Initiated
The CREATE_FAILED message occurred because I ran into a bucket limit. This left the stack in the state of ROLLBACK_COMPLETE and notably, the bucket ServerlessDeploymentBucket in the state of DELETE_COMPLETE. That is, it exists despite having failed. This means that when SLS asks if the stack exists, it finds that it does but then it attempts to query for the bucket and gets back:
{
"ResponseMetadata": {
"RequestId": "xxx"
},
"StackResourceDetail": {
"StackName": "serverless-artillery-BkhEK9uJg-dev",
"StackId": "arn:aws:cloudformation:<region>:<account>:stack/serverless-artillery-BkhEK9uJg-dev/<uuid>",
"LogicalResourceId": "ServerlessDeploymentBucket",
"ResourceType": "AWS::S3::Bucket",
"LastUpdatedTimestamp": "2016-10-22T07:46:47.778Z",
"ResourceStatus": "DELETE_COMPLETE",
"Metadata": "{}\n"
}
}
Notably, this is missing the attribute $.StackResourceDetail.PhysicalResourceId and that means that getServerlessDeploymentBucketName returns undefined from here:
https://github.com/serverless/serverless/blob/master/lib/plugins/aws/provider/awsProvider.js#L190
This means that this.bucketName is set to undefined here:
https://github.com/serverless/serverless/blob/master/lib/plugins/aws/lib/setBucketName.js#L17
And finally, the params attribute Bucket is set to undefined here:
https://github.com/serverless/serverless/blob/master/lib/plugins/aws/deploy/lib/cleanupS3Bucket.js#L18
This should occur any time the bucket is in an invalid state. I don't have the time to fix it right now but I debugged through and thought I'd share that work to save someone some time (or read later if this ever boosts in the priority stack).
I can confirm that deleting the stack as @adambiggs advises resolves the matter (having resolved the bucket limit issue prior to reattempting)
Also, used the npm published v1.0.3 to reproduce this
Thanks for reporting!
I'll close this one as steps to resolve this are provided (thanks for this!). Furthermore we're about to figure out what access Serverless actually need and will document that.
@erikerikson This might be a stupid question but how do you "delete the stack" and "resolve the bucket limiting issue". I have a similar issue but even running sls remove gives the same error and I'm not aware of any bucket limit for my s3 account.
@briananderson1222
RE: "bucket limit" > there are soft limits on the number of buckets you can have in an account. Your technical account manager (TAM) can help you get that raised if you're hitting a limit. Similarly you can delete buckets to get under the limit. Either of these resolving the "bucket limit" issue. You can also manually specify an existing bucket in your service in order to avoid proliferating buckets for each of your projects.
RE: "delete stack" > When I deleted the stack I did so from the console manually. If/when you get errors about things you cannot delete as part of deleting the stack, I noted what those things were, deleted the stack again, and clicked yes to continue deletion despite those resources. I then manually cleaned them up (i.e. for me, deleted the bucket from the S3 UI of the AWS console).
I have a new Serverless project (v1.5.0) and I'm getting the same error. Brand new AWS account with AdministratorAccess too. I don't notice any limits on s3.
$ sls deploy [ruby-2.3.1]
Serverless: Packaging service...
Serverless: Uploading CloudFormation file to S3...
Serverless Error ---------------------------------------
Missing required key 'Bucket' in params
Stack Trace --------------------------------------------
ServerlessError: Missing required key 'Bucket' in params
at Response.req.send (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:177:20)
at Request.<anonymous> (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:355:18)
at Request.callListeners (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)
at Request.transition (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:670:12)
at Request.callListeners (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
at Request.emit (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)
at Request.transition (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/ericshelley/.nvm/versions/node/v6.9.2/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Your Environment Information -----------------------------
OS: darwin
Node Version: 6.9.2
Serverless Version: 1.5.0
@bartimaeus could you please share your serverless.yml file? Do you use a custom deployment bucket?
service: serverless
frameworkVersion: "=1.5.0"
provider:
name: aws
runtime: nodejs4.3
stage: production
region: us-east-1
profile: serverless
functions:
hello:
handler: handler.hello
I actually just tried changing my stage to dev and the deploy worked. When I had production in the stage it failed. This is strange because I created another project earlier today with stage: production without any issue.
I'm not sure how to use a custom deployment bucket. I was trying to see if there was a way to manually create the bucket.
@pmuens nvm. My new AWS account defaulted to Global. Took me a while to realize. When I switched to N. Virginia I saw the failed stack and deleted it. I was then able to sls deploy again without issues.
The issue was no permission to s3:createBucket when I initially ran deploy.
Great @bartimaeus 馃憤
Thanks for sharing the instructions you've used to resolve this issue!
Let us know if you need any further help!
Can confirm: tried deploying without s3:createBucket-permissions, got expected error, but after receiving said permission got the Missing required key 'Bucket' in params-error.
i'm also having this error. First tried adding only required permissions 1 by 1. Then got the bucket error (i don't see the bucket in S3). Gave the user AdminAccess but no luck. What can i do ? Thanks
@flieks have you tried all the different solutions provided in the issue thread?
@flieks had the same issue as you. Added a s3:createBucket to my policy, and region to my serverless.yaml. For some reason serverless did not read region from profile:
service: my-service
provider:
name: aws
runtime: nodejs6.10
region: eu-west-1
profile: serverless
Thanks for the comment @Katafalkas 馃憤
For some reason serverless did not read region from profile
That's odd. Could you open up a separate issue so that we can track and resolve that? Thanks in advance!
Just came across this bug. I think it should be reopened because it's still there:
$ serverless deploy -v
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - camoto-dev
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_FAILED - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - ROLLBACK_IN_PROGRESS - AWS::CloudFormation::Stack - camoto-dev
CloudFormation - DELETE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - ROLLBACK_COMPLETE - AWS::CloudFormation::Stack - camoto-dev
Serverless: Operation failed!
Serverless Error ---------------------------------------
An error occurred: ServerlessDeploymentBucket - API: s3:CreateBucket Access Denied.
After this point, even once granting s3:CreateBucket access, nothing works:
$ serverless deploy -v
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless Error ---------------------------------------
Missing required key 'Bucket' in params
$ serverless remove
Serverless: Getting all objects in S3 bucket...
Serverless Error ---------------------------------------
Missing required key 'Bucket' in params
I guess I'm off to try and figure out what sls did and how to undo it manually!
Thanks for the comment @Malvineous 馃憤
Reopening...
I have the same problem.
It showed up when I specified the region in the provider block.
Without specifying the region, it works fine.
@michaelchiche Some services are only available in us-east-1, are you using some of those services? I also was not able to deploy a HTTPS API unless I set the region to us-east-1, however this is an AWS limitation rather than a Serverless bug.
As for this bug, once I went and manually removed all the resources that Serverless created, deployment then worked fine - no more 'missing required key' errors.
@Malvineous No, I was using a service that is available to all regions.
And as a matter of fact, it is very weird, I tried again a few hours later, in the region it failed, and it worked fine...
@pmuens @michaelchiche not sure this would help but;
I encountered this error today and it took me almost the entire second half of the day to figure it out.
So apparently, my AWS account is already at capacity of 101 buckets in S3!
I got An error occurred: ServerlessDeploymentBucket - You have attempted to create more buckets than allowed. the first time sls deploy failed.
Without looking into it much - I ran sls deploy again and I got Missing required key 'Bucket' in params.
It seems that the CF stack exist (but failed) in AWS but the deployment bucket had failed to be created hence it wasn't able to retrieve the bucket name (I think).
I had to delete the stack manually on CF and delete a couple buckets in S3, before running sls deploy again.
And voila - it worked.
See also #2791
still seeing this error. the CF template doesn't have a parameter that i can even see to override
Hi @erikerikson. Hope you're well. I just had a quick question regarding what you mentioned of: "You can also manually specify an existing bucket in your service in order to avoid proliferating buckets for each of your projects."
I've been trying to use an existing S3 bucket, but what I've been reading the last couple of days, points me to using an external Serverless library (serverless-plugin-existing-s3) for that purpose as the only option. I tried to use it, with no success. So, since I saw a pull request you created was merged by Serverless to the project; I really hope you can eventually let me know if what you mentioned on your comment requires the usage of an external library, or if it can be accomplished just by some configuration on Serverless.
Also, for what I've read on https://github.com/serverless/serverless/issues/4284 I noticed that @pmuens mentions (but that was last year) that Cloud Formation should be the ones who add support for the existing buckets to be handled
I'll be attentive to your comments
Best regards!
@Daniela0106 check out the deploymentBucket attribute: https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/ (currently line 20)
Thank you so much @erikerikson ! I'll give it a try 馃憤
Hi again @erikerikson . With what you mentioned, I was able to find what I needed in terms of connecting my Serverless architecture to my S3 bucket, so... THANK YOU SO MUCH!
Now I need the Lambda function I created to get the bucket as an asocciated event triggering source... Do you happen to know if there is a way of doing so?
I've read about AWS SAM and I've found: "To specify an S3 bucket as an event source for a Lambda function, both resources have to be declared in the same template. AWS SAM does not support specifying an existing bucket as an event source."
Source : https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#event-source-types
_*NOTE: Among other places in the web, I've found the same answer but I think that one is the most worth-mentioning. I have also been experimenting with different Resources declaration for my IamRoleStatement and for the function events Resources, but still I haven't been able to make it work._
Function:

Serverless.yml:

Bucket (And Serverless folder was created through Serverless Framework when running 'sls deploy'):

Lambda function does get deployed. But no event gets associated with it. (I don't want to declare manually the S3 as an event trigger, I would prefer doing so using Serverless Framework):

Please, in case you know and can help me, let me know!
Cheers!
Hi @Daniela010
These sorts of questions might be better asked in the community gitter channel: https://gitter.im/serverless/serverless - there is a strong community of people helping each other with this tool (which helps make it even better) and you'll find them there.
That said, you'll find the docs for S3 events at https://serverless.com/framework/docs/providers/aws/events/s3/ - basically you can remove Properties, lower case Bucket, and delete Type: s3.
You clearly put a lot of effort into your question so thank you for that (it made it easy to give a thorough answer). The docs are pretty good and cover the majority of uses. You might find adding "serverless framework" to your search queries will help narrow down your results and if you prefer chat (some of us do 馃槃) there is always the gitter channel. Since you are discovering the tool, it might be worth your time to check out https://serverless.com/framework/docs/providers/aws/guide/variables/ - you're already using some but those end up being particularly valuable and the answer to solving many challenges.
Welcome to the serverless community and enjoy your system building!
TY @erikerikson 馃憤 Have a nice day!
how can create an event to already exist Bucket with CF ?
Closing this issue since it's quite stale and we've published new versions with a lot of fixes in the past. Feel free to re-open if this is still a problem.
Most helpful comment
I was able to resolve this by deleting the stack in the AWS console and re-deploying with Serverless.
The issue was that my IAM profile didn't have some necessary permissions when I did the initial deploy, causing stack creation/rollback to fail. So the stack was left in a broken state on AWS.