Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

'sls remove' failed when there are more than one page of base path mappings #330

Closed
kzhou57 opened this issue May 6, 2020 · 2 comments 路 Fixed by #345
Closed

'sls remove' failed when there are more than one page of base path mappings #330

kzhou57 opened this issue May 6, 2020 · 2 comments 路 Fixed by #345
Labels

Comments

@kzhou57
Copy link

kzhou57 commented May 6, 2020

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Bug Report

Error Description
If there are more than one page of base path mappings (ApiMappings), there is a chance the sls remove will fail if the target mapping is not in first page returned from aws apigateway v2 getApiMappings().

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ApiGatewayV2.html#getApiMappings-property

The bug is not handling the NextToken in the response, so only works with items returned in first page.

Command Run
SLS_DEBUG=* sls remove

Console Output

... 
Serverless: [AWS apigatewayv2 200 0.389s 0 retries] getApiMappings({ DomainName: 'my.domain.name' })
Serverless Domain Manager: Error: my.domain.name:  TypeError: Cannot read property 'ApiMappingId' of undefined
Serverless: Error: Unable to remove base bath mappings
                        for domain my.domain.name
...
Serverless: Operation failed!
Serverless: View the full error output: 

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

  ServerlessError: An error occurred: ApiGatewayRestApi - Deleting RestApi v223i7rh69 failed. Please remove all base path mappings related to the RestApi in your domains: my.domain.name (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 0145476e-0443-4272-851c-52d87c079a7e).

Domain Manager Configuration
Replace this with your own serverless.yml file (anonymized, of course) to help us better resolve your issue.

custom:
  customDomain:
    domainName: foo.example.tld
    basePath: bar
    createRoute53Record: true

Versions

  • Domain Manager version(s): 3.3.2
  • Node/npm version: Node 12/npm 6]
  • Serverless Version: [1.69.0]
  • Lambda Code [e.g. Python]

Possible Solution

We should check the NextToken in the response, and iterate until the end of pages.

Additional context/Screenshots

@aoskotsky-amplify
Copy link
Member

This should have been fixed by #345. Let me know if you are still seeing the issue

@sps-software
Copy link

Just ran into this... Might have something to do with me changing the domain name from "www.domain.com" to "domain.com".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants