Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

Abortion in getDocumentationVersion that ends up in 'Invalid Documentation version specified'. #173

Open
bdoin opened this issue Apr 14, 2021 · 2 comments

Comments

@bdoin
Copy link

bdoin commented Apr 14, 2021

When AWS getDocumentationVersion is called and that there is no existing version for the API, the error catching is not performed properly and ends up in the error: 'Invalid Documentation version specified'

Not sure but this maybe due to a difference in the way serverless manages the error when calling AWS API.

Now the proper way to handle this is to test (err.providerError && err.providerError.code === 'NotFoundException')) instead of testing err.message === 'Invalid Documentation version specified'.

bdoin pushed a commit to bdoin/serverless-aws-documentation that referenced this issue Apr 14, 2021
bdoin pushed a commit to bdoin/serverless-aws-documentation that referenced this issue Apr 15, 2021
@rojanawi-droople
Copy link

Thanks for the fix!

@ottopecz
Copy link

The actual error object thrown by the serverless aws provider has changed in the newer versions.

The message of the thrown error has become longer although it includes the string 'Invalid Documentation version specified'

When expecting an error it's better to rely on something more abstract and formal than the message of the error. Good choices might include the code or the statusCode

We published a fix and we plan to maintain the package.
https://www.npmjs.com/package/@kakkuk/serverless-aws-apigateway-documentation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants