Repository: serverless/serverless (JavaScript) — Bug Fix

Issue:
ServerlessError: Missing required key 'deploymentId' in params
<!--
1. If you have a question and not a bug report please ask first at http://forum.serverless.com
2. Please check if an issue already exists. This bug may have already been documented
3. Check out and follow our Guidelines: https://github.com/serverless/serverless/blob/master/CONTRIBUTING.md
4. Fill out the whole template so we have a good overview on the issue
5. Do not remove any section of the template. If something is not applicable leave it empty but leave it in the Issue
6. Please follow the template, otherwise we'll have to ask you to update it
-->

# This is a Bug Report

## Description

- What went wrong?
When deploying, I get a error telling me `Missing required key 'deploymentId' in params`.  However, the stack deploys ok to AWS.

- What did you expect should have happened?
To deploy without throwing an error

- What was the config you used?

```
service: estore-collinson

provider:
  name: aws
  runtime: nodejs8.10
  region: eu-west-1

functions:
  updateRetailers:
    timeout: 30
    handler: handler.updateRetailers
    events:
      - schedule: rate(1 hour)
      - http:
          path: xxxx/update-retailers
          method: get
  updateBrowserPluginRetailers:
    timeout: 30
    handler: handler.updateBrowserPluginRetailers
    events:
      - schedule: rate(1 hour)
      - http:
          path: xxxx/update-browser-plugin-retailers
          method: get
  updateCategories:
    timeout: 30
    handler: handler.updateCategories
    events:
      - schedule: rate(1 hour)
      - http:
          path: xxxx/update-categories
          method: get
```
- What stacktrace or error message from your provider did you see?

```
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 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: Excluding development dependencies...
Serverless:
User stats error: Request network error: { FetchError: network timeout at: https://tracking.serverlessteam.com/v1/track
    at Timeout._onTimeout (/usr/local/lib/node_modules/serverless/node_modules/node-fetch/index.js:126:13)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)
  name: 'FetchError',
  message:
   'network timeout at: https://tracking.serverlessteam.com/v1/track',
  type: 'request-timeout' }
Serverless: Invoke aws:package:finalize
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: WARNING: Function updateRetailers has timeout of 180 seconds, however, it's attached to API Gateway so it's automatically limited to 30 seconds.
Serverless: WARNING: Function updateBrowserPluginRetailers has timeout of 180 seconds, however, it's attached to API Gateway so it's automatically limited to 30 seconds.
Serverless: WARNING: Function updateCategories has timeout of 180 seconds, however, it's attached to API Gateway so it's automatically limited to 30 seconds.
Serverless: Invoke aws:deploy:deploy
Serverless: [AWS cloudformation 200 0.172s 0 retries] describeStacks({ StackName: 'xxxx-xxxx-staging' })
Serverless: [AWS cloudformation 200 0.117s 0 retries] describeStackResource({ StackName: 'xxxx-xxxx-staging',
  LogicalResourceId: 'ServerlessDeploymentBucket' })
Serverless: [AWS s3 200 0.139s 0 retries] listObjectsV2({ Bucket:
   'xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f',
  Prefix: 'serverless/xxxx-xxxx/staging' })
Serverless: [AWS s3 200 0.104s 0 retries] headObject({ Bucket:
   'xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f',
  Key:
   'serverless/xxxx-xxxx/staging/1568712380977-2019-09-17T09:26:20.977Z/compiled-cloudformation-template.json' })
Serverless: [AWS s3 200 0.118s 0 retries] headObject({ Bucket:
   'xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f',
  Key:
   'serverless/xxxx-xxxx/staging/1568712380977-2019-09-17T09:26:20.977Z/xxxx-xxxx.zip' })
Serverless: [AWS lambda 200 0.133s 0 retries] getFunction({ FunctionName: 'xxxx-xxxx-staging-updateRetailers' })
Serverless: [AWS lambda 200 0.134s 0 retries] getFunction({ FunctionName: 'xxxx-xxxx-staging-updateBrowserPluginRetailers' })
Serverless: [AWS lambda 200 0.085s 0 retries] getFunction({ FunctionName: 'xxxx-xxxx-staging-updateCategories' })
Serverless: [AWS sts 200 0.374s 0 retries] getCallerIdentity({})
Serverless: Uploading CloudFormation file to S3...
Serverless: [AWS s3 200 0.157s 0 retries] putObject({ Body:
   <Buffer 7b 22 41 57 53 54 65 6d 70 6c 61 74 65 46 6f 72 6d 61 74 56 65 72 73 69 6f 6e 22 3a 22 32 30 31 30 2d 30 39 2d 30 39 22 2c 22 44 65 73 63 72 69 70 74 ... >,
  Bucket:
   'xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f',
  Key:
   'serverless/xxxx-xxxx/staging/1568729178636-2019-09-17T14:06:18.636Z/compiled-cloudformation-template.json',
  ContentType: 'application/json',
  Metadata:
   { filesha256: 'l5XBdeyv3A1KU+eNW0fWyL8pjZm8TGPHq3sGwlLTExc=' } })
Serverless: Uploading artifacts...
Serverless: Uploading service xxxx-xxxx.zip file to S3 (7.64 MB)...
Serverless: [AWS s3 200 0.144s 0 retries] createMultipartUpload({ Bucket:
   'xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f',
  Key:
   'serverless/xxxx-xxxx/staging/1568729178636-2019-09-17T14:06:18.636Z/xxxx-xxxx.zip',
  ContentType: 'application/zip',
  Metadata:
   { filesha256: 'E7PcVQQT7bgPnex9JZ2pR0nfPdmhGrJpKu/U6Sywqto=' } })
Serverless: [AWS s3 200 4.891s 0 retries] uploadPart({ Body:
   <Buffer 50 4b 03 04 14 00 08 00 08 00 00 00 21 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 2e 65 6e 76 95 92 5f 8f 9a 40 14 c5 df fd 16 4d da 57 fe c8 ... >,
  ContentLength: 5242880,
  PartNumber: 1,
  Bucket:
   'xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f',
  Key:
   'serverless/xxxx-xxxx/staging/1568729178636-2019-09-17T14:06:18.636Z/xxxx-xxxx.zip',
  UploadId:
   '.knKd.IGOlJodPYkmqrArT9ZsVTD2_3d05f1nyZBhxRVYFEDgpxW9FweADkXN.b9qLZiMzDxjIWPxctAMaMsMJO7BBVlf_nn1PH1sgB5MZ8LlUaxFZ_WRWdnHUthl438' })
Serverless: [AWS s3 200 7.07s 0 retries] uploadPart({ Body:
   <Buffer 8c 20 01 4a 9f 16 d7 75 f3 10 45 51 14 45 51 d5 07 4a 5d 74 80 6d f0 19 08 a9 fa ef dd 3a d4 3b 5e ab 95 ae 12 48 96 99 1b 66 67 e7 76 7f 98 43 5a 3a ... >,
  ContentLength: 2771923,
  PartNumber: 2,
  Bucket:
   'xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f',
  Key:
   'serverless/xxxx-xxxx/staging/1568729178636-2019-09-17T14:06:18.636Z/xxxx-xxxx.zip',
  UploadId:
   '.knKd.IGOlJodPYkmqrArT9ZsVTD2_3d05f1nyZBhxRVYFEDgpxW9FweADkXN.b9qLZiMzDxjIWPxctAMaMsMJO7BBVlf_nn1PH1sgB5MZ8LlUaxFZ_WRWdnHUthl438' })
Serverless: [AWS s3 200 0.158s 0 retries] completeMultipartUpload({ MultipartUpload:
   { Parts:
      [ { ETag: '"c1ea10b2eaa3d428bbb0fa462faf917c"', PartNumber: 1 },
        { ETag: '"8486b9470fa8b1cdcc480ad3c9cf61cb"', PartNumber: 2 },
        [length]: 2 ] },
  Bucket:
   'xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f',
  Key:
   'serverless/xxxx-xxxx/staging/1568729178636-2019-09-17T14:06:18.636Z/xxxx-xxxx.zip',
  UploadId:
   '.knKd.IGOlJodPYkmqrArT9ZsVTD2_3d05f1nyZBhxRVYFEDgpxW9FweADkXN.b9qLZiMzDxjIWPxctAMaMsMJO7BBVlf_nn1PH1sgB5MZ8LlUaxFZ_WRWdnHUthl438' })
Serverless: Validating template...
Serverless: [AWS cloudformation 200 0.175s 0 retries] validateTemplate({ TemplateURL:
   'https://s3.amazonaws.com/xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f/serverless/xxxx-xxxx/staging/1568729178636-2019-09-17T14:06:18.636Z/compiled-cloudformation-template.json' })
Serverless: Updating Stack...
Serverless: [AWS cloudformation 200 0.251s 0 retries] updateStack({ StackName: 'xxxx-xxxx-staging',
  Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ],
  Parameters: [ [length]: 0 ],
  TemplateURL:
   'https://s3.amazonaws.com/xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f/serverless/xxxx-xxxx/staging/1568729178636-2019-09-17T14:06:18.636Z/compiled-cloudformation-template.json',
  Tags: [ { Key: 'STAGE', Value: 'staging' }, [length]: 1 ] })
Serverless: Checking Stack update progress...
Serverless: [AWS cloudformation 200 0.265s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
CloudFormation - UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - xxxx-xxxx-staging
CloudFormation - UPDATE_IN_PROGRESS - AWS::Lambda::Function - UpdateRetailersLambdaFunction
CloudFormation - UPDATE_IN_PROGRESS - AWS::Lambda::Function - UpdateBrowserPluginRetailersLambdaFunction
CloudFormation - UPDATE_IN_PROGRESS - AWS::Lambda::Function - UpdateCategoriesLambdaFunction
CloudFormation - UPDATE_COMPLETE - AWS::Lambda::Function - UpdateRetailersLambdaFunction
CloudFormation - UPDATE_COMPLETE - AWS::Lambda::Function - UpdateBrowserPluginRetailersLambdaFunction
CloudFormation - UPDATE_COMPLETE - AWS::Lambda::Function - UpdateCategoriesLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - UpdateRetailersLambdaVersioncTqQkIkm5j1uqkumySkSyFJh3KGjDTO6kd6LilhU
Serverless: [AWS cloudformation 200 0.22s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
CloudFormation - CREATE_IN_PROGRESS - AWS::Events::Rule - UpdateCategoriesEventsRuleSchedule1
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1568729160515
CloudFormation - CREATE_IN_PROGRESS - AWS::Events::Rule - UpdateCategoriesEventsRuleSchedule1
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - UpdateRetailersLambdaVersioncTqQkIkm5j1uqkumySkSyFJh3KGjDTO6kd6LilhU
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - UpdateBrowserPluginRetailersLambdaVersionMSZGGyV4QyimR5Z7638GVUp0NTrKDMtofhv0k3A65fU
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - UpdateCategoriesLambdaVersion1d3l2ST62UXam7Dx80SF4O1dCqyhMFcK6lkx83whiY
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - UpdateRetailersLambdaVersioncTqQkIkm5j1uqkumySkSyFJh3KGjDTO6kd6LilhU
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1568729160515
CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1568729160515
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - UpdateBrowserPluginRetailersLambdaVersionMSZGGyV4QyimR5Z7638GVUp0NTrKDMtofhv0k3A65fU
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - UpdateBrowserPluginRetailersLambdaVersionMSZGGyV4QyimR5Z7638GVUp0NTrKDMtofhv0k3A65fU
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - UpdateCategoriesLambdaVersion1d3l2ST62UXam7Dx80SF4O1dCqyhMFcK6lkx83whiY
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - UpdateCategoriesLambdaVersion1d3l2ST62UXam7Dx80SF4O1dCqyhMFcK6lkx83whiY
Serverless: [AWS cloudformation 200 0.39s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.575s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.328s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.24s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.212s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.408s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.33s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.229s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.201s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.287s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.299s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
CloudFormation - CREATE_COMPLETE - AWS::Events::Rule - UpdateCategoriesEventsRuleSchedule1
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Permission - UpdateCategoriesLambdaPermissionEventsRuleSchedule1
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Permission - UpdateCategoriesLambdaPermissionEventsRuleSchedule1
Serverless: [AWS cloudformation 200 0.277s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
Serverless: [AWS cloudformation 200 0.283s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Permission - UpdateCategoriesLambdaPermissionEventsRuleSchedule1
Serverless: [AWS cloudformation 200 0.267s 0 retries] describeStackEvents({ StackName:
   'arn:aws:cloudformation:xxxx:xxxx:stack/xxxx-xxxx-staging/27a0dfd0-d8dc-11e9-8d9e-0a00435bc49c' })
CloudFormation - UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - xxxx-xxxx-staging
CloudFormation - DELETE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1568712366408
CloudFormation - DELETE_SKIPPED - AWS::Lambda::Version - UpdateRetailersLambdaVersion9G7d83yd3EY4xmrWCFw7qg1zrADqviuTpXrtswX1tOg
CloudFormation - DELETE_SKIPPED - AWS::Lambda::Version - UpdateCategoriesLambdaVersionMVjWFN8yvb7DNC57hZkMnkirAVMGckMETi341ooE4gU
CloudFormation - DELETE_SKIPPED - AWS::Lambda::Version - UpdateBrowserPluginRetailersLambdaVersionABvH4bl2QznBvyrxlQRt3nm5DIoaDDtmbyAxhg9Y
CloudFormation - DELETE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1568712366408
CloudFormation - UPDATE_COMPLETE - AWS::CloudFormation::Stack - xxxx-xxxx-staging
Serverless: Stack update finished...
Serverless: Invoke aws:info
Serverless: [AWS cloudformation 200 0.113s 0 retries] describeStacks({ StackName: 'xxxx-xxxx-staging' })
Serverless: [AWS cloudformation 200 0.158s 0 retries] listStackResources({ StackName: 'xxxx-xxxx-staging' })
Service Information
service: xxxx-xxxx
stage: staging
region: xxxx
stack: xxxx-xxxx-staging
resources: 29
api keys:
  None
endpoints:
  GET - https://xxxx.execute-api.xxxx.amazonaws.com/staging/xxxx/update-retailers
  GET - https://xxxx.execute-api.xxxx.amazonaws.com/staging/xxxx/update-browser-plugin-retailers
  GET - https://xxxx.execute-api.xxxx.amazonaws.com/staging/xxxx/update-categories
functions:
  updateRetailers: xxxx-xxxx-staging-updateRetailers
  updateBrowserPluginRetailers: xxxx-xxxx-staging-updateBrowserPluginRetailers
  updateCategories: xxxx-xxxx-staging-updateCategories
layers:
  None

Stack Outputs
UpdateCategoriesLambdaFunctionQualifiedArn: arn:aws:lambda:xxxx:xxxx:function:xxxx-xxxx-staging-updateCategories:3
UpdateRetailersLambdaFunctionQualifiedArn: arn:aws:lambda:xxxx:xxxx:function:xxxx-xxxx-staging-updateRetailers:3
ServiceEndpoint: https://xxxx.execute-api.xxxx.amazonaws.com/staging
ServerlessDeploymentBucketName: xxxx-xxxx-staging-serverlessdeploymentbuck-b0ruqrf2fm9f
UpdateBrowserPluginRetailersLambdaFunctionQualifiedArn: arn:aws:lambda:xxxx:xxxx:function:xxxx-xxxx-staging-updateBrowserPluginRetailers:4

Serverless: [AWS sts 200 0.402s 0 retries] getCallerIdentity({})
Serverless: [AWS apigateway 200 0.227s 0 retries] getRestApis({ position: undefined, limit: 500 })
Serverless: [AWS apigateway 404 0.101s 0 retries] getStage({ restApiId: 'xxxx', stageName: 'staging' })
Serverless: [AWS apigateway 200 0.102s 0 retries] getDeployments({ restApiId: 'xxxx', limit: 500 })
Serverless: [AWS apigateway undefined 0.004s 0 retries] createStage({ deploymentId: null,
  restApiId: 'xxxx',
  stageName: 'staging' })

  Serverless Error ---------------------------------------

  ServerlessError: Missing required key 'deploymentId' in params
      at promise.catch.err (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:317:27)
      at process._tickCallback (internal/process/next_tick.js:68:7)
```
Just want to highlight the last section
```
Serverless: [AWS apigateway undefined 0.004s 0 retries] createStage({ deploymentId: null,
  restApiId: 'xxxx',
  stageName: 'staging' })
```
The deploymentId is null. I can't find anything in your documentation about this. 

Similar or dependent issues:

- #12345

## Additional Data

- **_Serverless Framework Version you're using_**: 1.52.0
- **_Operating System_**:
```
     Operating System:          darwin, Mac High Sierra, Version 10.13.6
     Node Version:              10.15.3
     Framework Version:         1.52.0
     Plugin Version:            2.0.0
     SDK Version:               2.1.1
```
- **_Stack Trace_**:
- **_Provider Error messages_**:



Discussion:
It looks like there were problems with the dependent module "aws-sdk" and is already working
Hi, I faced exactly the same issue.
I went to API Gateway and saw a lot of duplicate empty apis not removed from previous failed deployments. After I cleaned up API Gateway, the deployment worked.
@lqueiroga did help for me too. But the warning "You have exceeded the number of APIs you can delete per minute. Please try again soon." wasn't helping.
Yeah, this seems to happen if you have a dupe API in apigw with the same name. Just ran into it.
Happens to me for a project which doesn't have any lambdas with API GW attached, but has 

```yml
apiGateway:
    minimumCompressionSize: 0
```

Could it be a reason?
I am also running into this error. 
```
Serverless Error ---------------------------------------
 
  Missing required key 'deploymentId' in params
 
```

Here is my serverless.yml
```
service: cats

app: api-cats
org: xxxxxxx

provider:
  name: aws
  runtime: nodejs12.x

  stage: dev
  region: us-west-2

resources:
  Resources:
    MyApiGW:
      Type: AWS::ApiGateway::RestApi
      Properties:
        Name: MyApiGW

  Outputs:
    apiGatewayRestApiId:
      Value:
        Ref: MyApiGW
      Export:
        Name: MyApiGateway-restApiId

    apiGatewayRestApiRootResourceId:
      Value:
        Fn::GetAtt:
          - MyApiGW
          - RootResourceId
      Export:
        Name: MyApiGateway-rootResourceId
```
Got the error when using the following config to deploy an API Gateway without any associated lambdas:

```
frameworkVersion: '^1.61'
custom: ${file(../config.yml)}
service:
  name: gcx-gateway
provider:
  name: aws
  region: ${opt:region, self:custom.region}
  endpointType: ${self:custom.endpointType}
  stage: ${opt:stage, self:custom.stage}
  profile: ${self:custom.profiles.${self:provider.stage}}
  stackName: ${self:service.name}-${self:provider.stage}
  deploymentBucket:
    blockPublicAccess: true
  logs:
    restApi: true
  tracing:
    apiGateway: true
    lambda: true
resources:
  Resources:
    gcxGateway:
      Type: AWS::ApiGateway::RestApi
      Properties:
        Name: ${self:custom.apiGateway.name}
  Outputs:
    apiGatewayRestApiId:
      Value:
        Ref: ${self:custom.apiGateway.name}
      Export:
        Name: ${self:custom.apiGateway.restApiId}
    apiGatewayRestApiRootResourceId:
      Value:
        Fn::GetAtt:
          - ${self:custom.apiGateway.name}
          - RootResourceId
      Export:
        Name: ${self:custom.apiGateway.restApiRootResourceId}
```

It looks like removing the following from "provider" fixed the error:
```
logs:
  restApi: true
tracing:
  apiGateway: true
  lambda: true
```

It also happens to me, but I found a (ugly as hell) workaround : using an older version of serverless framework.

1.62.0 => Doesn't work, missing deploymentId error
1.54.0 => Works

Here the config file.

```
frameworkVersion: ">=1.0.0 <2.0.0"

service: 
  name: chatbot-resources 

provider:
  name: aws
  runtime: nodejs8.10
  stage: ${env:STAGE}
  region: eu-west-1
  deploymentBucket:
    name: mybucketname001-${self:provider.stage}
  tags:
    Name: ${self:service}
    Environment: ${env:STAGE}
    cost-center: mycostcenter

resources:
  Resources: 

    chatbotApiGateway:
      Type: "AWS::ApiGateway::RestApi"
      Properties:
        Name: "api-chatbot-${env:STAGE}"
        Description: "Api endpoints for chatbot resources"

    SSMChatbotApiGatewayRestId:
      Type: AWS::SSM::Parameter
      DependsOn: chatbotApiGateway
      Properties:
        Name: /${env:STAGE}/chatbot/api/rest-id
        Description: 'Rest id of the chatbot api gateway, ${env:STAGE} environment'
        Type: String
        Value: !Ref chatbotApiGateway

    SSMChatbotApiGatewayRootResourceId:
      Type: AWS::SSM::Parameter
      DependsOn: chatbotApiGateway
      Properties:
        Name: /${env:STAGE}/chatbot/api/root-resource-id
        Description: 'Root resource id of the chatbot api gateway, ${env:STAGE} environment'
        Type: String
        Value: !GetAtt chatbotApiGateway.RootResourceId```


It worked for me when I reverted to serverless@1.61.3. But then after a few days it started again. Turns out the deployment still worked though. 🤯
Above 1.61.1 seems to get this error. 

It seems to be used for the websocket connection in apigw.

Can it be introduces in this commit
https://github.com/serverless/serverless/commit/9f0131fedf60e9104f38702d01e103b9a3b0f629
Also experiencing this issue on first deployment of a stack with the following yaml.  from what we can tell, the stack deploys fine.

Here is the end of the debug logs - I see a second API gateway instance being created with deploymentId of `null`

```
Serverless: [AWS sts 200 0.148s 0 retries] getCallerIdentity({})
Serverless: [AWS apigateway 200 0.867s 0 retries] getRestApis({ position: undefined, limit: 500 })
Serverless: [AWS apigateway 404 0.115s 0 retries] getStage({ restApiId: 'fb2j8y9esl', stageName: 'dev' })
Serverless: [AWS apigateway 200 0.122s 0 retries] getDeployments({ restApiId: 'fb2j8y9esl', limit: 500 })
Serverless: [AWS apigateway undefined 0.014s 0 retries] createStage({ deploymentId: null, restApiId: 'fb2j8y9esl', stageName: 'dev' })
  Serverless Error ---------------------------------------
  ServerlessError: Missing required key 'deploymentId' in params
      at /Users/carloscalero/.nvm/versions/node/v12.14.0/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:329:27
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
 ```


```
service: 
  name: api-base

frameworkVersion: ">=1.2.0 <2.0.0"

plugins:
  - serverless-plugin-optimize
  - serverless-offline
  - serverless-pseudo-parameters
  - serverless-domain-manager

custom:
  stage: ${self:provider.stage, 'dev'}
  serverless-offline:
    port: ${env:OFFLINE_PORT, '4000'}
  false: false
  cognitoStack: marley-auth
  customDomain:
    domainName: ${env:BE_HOST, ''}
    enabled: ${env:EN_CUSTOM_DOMAIN, self:custom.false}
    stage: ${self:provider.stage, 'dev'}
    createRoute53Record: true

provider:
  name: aws
  runtime: nodejs12.x
  versionFunctions: true
  apiName: public
  logs:
    restApi: true
  stackTags:
      COMMIT_SHA: ${env:COMMIT_SHA, 'NO-SHA'}
  environment:
    USER_POOL_ID: ${cf:${self:custom.cognitoStack}-${self:custom.stage}.UserPoolId}
    CLIENT_ID: ${cf:${self:custom.cognitoStack}-${self:custom.stage}.UserPoolClientId}
  timeout: 30
  iamRoleStatements:
  - Effect: "Allow"
    Action:
      - "lambda:InvokeFunction"
    Resource: "*"
  - Effect: Allow
    Action:
      - cognito-idp:*
    Resource: 
      Fn::Sub: arn:aws:cognito-idp:#{AWS::Region}:#{AWS::AccountId}:userpool/*

functions:
  authorizer:
    handler: handler/authorize.handler

resources:
  - ${file(${env:BACKEND_PATH}/sls/resources/errors.yml)}
  - Outputs:
      ApiGatewayRestApiId:
        Value:
          Ref: ApiGatewayRestApi
        Export:
          Name: ${self:custom.stage}-${self:provider.apiName}-ApiGatewayRestApiId
      ApiGatewayRestApiRootResourceId:
        Value:
          Fn::GetAtt:
            - ApiGatewayRestApi
            - RootResourceId 
        Export:
          Name: ${self:custom.stage}-${self:provider.apiName}-ApiGatewayRestApiRootResourceId
      SharedAuthorizerId:
        Value:
          Ref: SharedAuthorizer
        Export:
          Name: ${self:custom.stage}-${self:provider.apiName}-ApiGatewaySharedAuthorizerId
  - Resources:
      SharedAuthorizer:
        Type: AWS::ApiGateway::Authorizer
        Properties:
          Name: public
          AuthorizerUri: !Join 
            - ''
            - - 'arn:aws:apigateway:'
              - !Ref 'AWS::Region'
              - ':lambda:path/2015-03-31/functions/'
              - !GetAtt 
                - AuthorizerLambdaFunction
                - Arn
              - /invocations
          RestApiId: !Ref 'ApiGatewayRestApi'
          Type: REQUEST
          IdentitySource: method.request.header.Authorization
          AuthorizerResultTtlInSeconds: '300'
        DependsOn: AuthorizerLambdaFunction
      ApiAuthLambdaPermission:
        Type: AWS::Lambda::Permission
        Properties:
          Action: lambda:InvokeFunction
          FunctionName: !Ref AuthorizerLambdaFunction
          Principal: apigateway.amazonaws.com
          SourceArn: !Sub "arn:aws:execute-api:#{AWS::Region}:#{AWS::AccountId}:#{ApiGatewayRestApi}/authorizers/*"
        DependsOn: ApiGatewayRestApi

  ```
as @vladgolubev mentioned above, happens to me when there are 0 functions.
Meet same error.
Might introduced in this commit dfa0967 and issue https://github.com/serverless/serverless/issues/7036. 

No deployment exist when only API Gateway resources defined.
I'm also getting this after upgrading from 1.57.0 to 1.67.0.

It fails to complete the deploy, but it seems to me that everything but the API stage (also called deployment) is created. Every consecutive deploy also fails with the same error.

> Serverless: [AWS sts 200 0.519s 0 retries] getCallerIdentity({})
> Serverless: [AWS apigateway 200 0.354s 0 retries] getRestApis({ position: undefined, limit: 500 })
> Serverless: [AWS apigateway 404 0.219s 0 retries] getStage({ restApiId: 'jmzn9w69x0', stageName: 'dev' })
> Serverless: [AWS apigateway 200 0.232s 0 retries] getDeployments({ restApiId: 'jmzn9w69x0', limit: 500 })
> Serverless: [AWS apigateway undefined 0.242s 0 retries] createStage({ deploymentId: null, restApiId: 'jmzn9w69x0', stageName: 'dev' })
> 
>   Serverless Error ---------------------------------------
> 
>   ServerlessError: Missing required key 'deploymentId' in params
>       at C:\Users\jfroland\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:331:27
>       at processTicksAndRejections (internal/process/task_queues.js:93:5)

It seems that serverless is trying to create a stage based on an existing stage. But without any existing stage (since its the first deploy), that will fail. 

If I however add a stage manually after the first failed deploy and then deploy, serverless goes through without any error.

How about using the apigatewayv2? It doesn't need a reference to an existing stage: https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/apis-apiid-stages.html

This is taken from the boto3-doc (python library for AWS) of apigateway (v1) for method create_stage():

> Creates a new Stage resource that **references a pre-existing Deployment** for the API.

V2 only require apiId and stageName. Wouldnt this also keep the history of stages?

Edit: Btw. also tested adding the stage as a native Resource with the same stage name as provider.stage. That worked, and I will use this as a "workaround" for now.

Edit2: If I add a stage as a native Resource with another stage name as provider.stage, it fails the first deploy. After a second deploy, it succeeds and end up creating two stages. One based on provider.stage name, and the second with the name from the native resource.

My environment:

>  Your Environment Information ---------------------------
>      Operating System:          win32
>      Node Version:              12.13.0
>      Framework Version:         1.67.0
>      Plugin Version:            3.6.1
>      SDK Version:               2.3.0
>      Components Version:        2.22.3
 i am also facing the same issue when deploying an api gateway without lambda. is there any fix?


Resolving patch:
diff --git a/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.js b/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.js
index 66095961bfb..3720e5fb4c6 100644
--- a/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.js
+++ b/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.js
@@ -100,13 +100,23 @@ function resolveAccountInfo() {
 }
 
 function resolveApiGatewayResource(resources) {
-  if (resources.ApiGatewayRestApi) return resources.ApiGatewayRestApi;
-  const apiGatewayResources = _.values(resources).filter(
+  const apiGatewayResources = _.pickBy(
+    resources,
     resource => resource.Type === 'AWS::ApiGateway::RestApi'
   );
-  if (apiGatewayResources.length === 1) return apiGatewayResources[0];
-  // None, or more than one API Gateway found (currently there's no support for multiple APIGW's)
-  return null;
+  const apiGatewayResourcesIds = Object.keys(apiGatewayResources);
+  if (apiGatewayResourcesIds.length !== 1) return null;
+  const apiGatewayResourceId = apiGatewayResourcesIds[0];
+  if (
+    !_.findKey(resources, resource => {
+      if (resource.Type !== 'AWS::ApiGateway::Deployment') return false;
+      if (!resource.Properties || !resource.Properties.RestApiId) return false;
+      return resource.Properties.RestApiId.Ref === apiGatewayResourceId;
+    })
+  ) {
+    return null;
+  }
+  return apiGatewayResources[apiGatewayResourceId];
 }
 
 function resolveRestApiId() {
@@ -121,9 +131,11 @@ function resolveRestApiId() {
     const apiGatewayResource = resolveApiGatewayResource(
       this.serverless.service.provider.compiledCloudFormationTemplate.Resources
     );
-    const apiName = apiGatewayResource
-      ? apiGatewayResource.Properties.Name
-      : provider.apiName || `${this.options.stage}-${this.state.service.service}`;
+    if (!apiGatewayResource) {
+      resolve(null);
+      return;
+    }
+    const apiName = apiGatewayResource.Properties.Name;
     const resolveFromAws = position =>
       this.provider.request('APIGateway', 'getRestApis', { position, limit: 500 }).then(result => {
         const restApi = result.items.find(api => api.name === apiName);


Test patch:
diff --git a/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.test.js b/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.test.js
index b24ab4273f5..d7dc475ccda 100644
--- a/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.test.js
+++ b/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.test.js
@@ -46,6 +46,14 @@ describe('#updateStage()', () => {
             Name: 'dev-my-service',
           },
         },
+        ApiGatewayRestApiDeployment: {
+          Type: 'AWS::ApiGateway::Deployment',
+          Properties: {
+            RestApiId: {
+              Ref: 'ApiGatewayRestApi',
+            },
+          },
+        },
       },
     };
 
@@ -492,18 +500,19 @@ describe('#updateStage()', () => {
     resources.CustomApiGatewayRestApi = resources.ApiGatewayRestApi;
     delete resources.ApiGatewayRestApi;
     resources.CustomApiGatewayRestApi.Properties.Name = 'custom-rest-api-name';
+    resources.ApiGatewayRestApiDeployment.Properties.RestApiId.Ref = 'CustomApiGatewayRestApi';
     return updateStage.call(context).then(() => {
       expect(context.apiGatewayRestApiId).to.equal('customRestApiId');
     });
   });
 
-  it('should resolve with a default api name if the AWS::ApiGateway::Resource is not present', () => {
+  it('should not resolve if the AWS::ApiGateway::Resource is not present', () => {
     context.state.service.provider.tracing = { apiGateway: false };
     const resources = context.serverless.service.provider.compiledCloudFormationTemplate.Resources;
     delete resources.ApiGatewayRestApi;
     options.stage = 'prod';
     return updateStage.call(context).then(() => {
-      expect(context.apiGatewayRestApiId).to.equal('prodRestApiId');
+      expect(context.apiGatewayRestApiId).to.equal(null);
     });
   });