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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local DynamoDB instance does not have describeContinuousBackup API, so models not fully initializing #124

Closed
DaddyGrimmlin opened this issue Nov 2, 2018 · 2 comments
Assignees
Labels

Comments

@DaddyGrimmlin
Copy link

BloopException gets thrown at bloop.session.py Line:181 due to:

from botocore.client.py
def _make_api_call(self, operation_name, api_params) [Line: 578]
http object @ Line: 620

http.status_code == 400
operation_name == DescribeContinuousBackups
parsed_response == {'Error': {'Message': 'An unknown operation was requested.', 'Code': 'UnknownOperationException'}, 'ResponseMetadata': {'RequestId': 'f7e28201-a69e-4f49-8721-6e1afd494b0e', 'HTTPStatusCode': 400, 'HTTPHeaders': {'content-type': 'application/x-amz-json-1.0', 'x-amzn-requestid': 'f7e28201-a69e-4f49-8721-6e1afd494b0e', 'content-length': '119', 'server': 'Jetty(8.1.12.v20130726)'}, 'RetryAttempts': 0}}

Does not see as though local dynamoDB has API for DescribeContinuousBackups.

Tried javascript API directly in web browser terminal and got invalid function error.

This keeps the ARN from initializing on models with streams enabled; therefore, streams fail to work; however, tables will be created from models and work properly (just not the streams).

Going to mock the boto3 DescribeContinuousBackups client function as a workaround.

@numberoverzero
Copy link
Owner

Thanks for opening an issue, and sorry this is probably causing some frustration. I really wish AWS would keep DynamoDBLocal up to date with their public service. It was probably an intern project though :)

I'd recommend using the pattern in https://bloop.readthedocs.io/en/latest/user/patterns.html#dynamodb-local to stub the methods on your client. Just drop that patch_local.py in your testing directory or copy/paste the code into your test setup.

As mentioned in #117 you could also try LocalStack, but due to localstack/localstack#728 I wouldn't recommend it.

I'm going to update the docs pattern above so that you can return dynamic values. Probably something like:

class PatchedDynamoDBClient:
    ... #existing code
    def __init__(self, ...):
        self.mock_ttl = {}
        self.mock_cb = {}

    def describe_time_to_live(self, TableName, **_):
        r = "ENABLED" if self.mock_ttl.get(TableName, False) else "DISABLED"
        return {"ContinuousBackupsDescription": {"ContinuousBackupsStatus": r}}

@numberoverzero
Copy link
Owner

I'm going to close this for now. If more or different examples would help please leave a comment or re-open this issue.

Thanks!

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

No branches or pull requests

2 participants