amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

backfill script doesn't work after migration to transformer v2

Open CodySwannGT opened this issue 3 years ago • 3 comments

Before opening, please confirm:

  • [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • [X] I have searched for duplicate or closed issues.
  • [X] I have read the guide for submitting bug reports.
  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

8.0.2

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Amplify Categories

Not applicable

Amplify Commands

Not applicable

Describe the bug

After upgrading to transformer v 2, we can no longer run the backfill script here: AWS.config.credentials

{'ResponseMetadata': {'RequestId': '9e18740d-87d1-40a1-8b47-20ed960851c3', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Tue, 03 May 2022 00:49:48 GMT', 'content-type': 'application/json', 'content-length': '4', 'connection': 'keep-alive', 'x-amzn-requestid': '9e18740d-87d1-40a1-8b47-20ed960851c3', 'x-amzn-remapped-content-length': '0', 'x-amz-executed-version': '$LATEST', 'x-amzn-trace-id': 'root=1-62707c2a-7f25c8cb5368f0b93259c35a;sampled=0'}, 'RetryAttempts': 0}, 'StatusCode': 200, 'ExecutedVersion': '$LATEST', 'Payload': <botocore.response.StreamingBody object at 0x10377eb20>}
Traceback (most recent call last):
  File "/Users/cody/workspace/javascript/serverless/propswapv2/scripts/search/backfill.py", line 104, in <module>
    main()
  File "/Users/cody/workspace/javascript/serverless/propswapv2/scripts/search/backfill.py", line 42, in main
    import_dynamodb_items_to_es(args.tn, args.sk, args.ak, args.st, args.rn, args.esarn, args.lf, scan_limit)
  File "/Users/cody/workspace/javascript/serverless/propswapv2/scripts/search/backfill.py", line 65, in import_dynamodb_items_to_es
    response = table.scan(ExclusiveStartKey=response['LastEvaluatedKey'], Limit=scan_limit)
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/resources/factory.py", line 520, in do_action
    response = action(self, *args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/resources/action.py", line 83, in __call__
    response = getattr(parent.meta.client, operation_name)(*args, **params)
  File "/opt/homebrew/lib/python3.9/site-packages/botocore/client.py", line 391, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/botocore/client.py", line 708, in _make_api_call
    self.meta.events.emit(
  File "/opt/homebrew/lib/python3.9/site-packages/botocore/hooks.py", line 357, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/transform.py", line 202, in inject_attribute_value_output
    self._transformer.transform(
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/transform.py", line 253, in transform
    self._transform_parameters(
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/transform.py", line 260, in _transform_parameters
    getattr(self, '_transform_%s' % type_name)(
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/transform.py", line 274, in _transform_structure
    self._transform_parameters(
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/transform.py", line 260, in _transform_parameters
    getattr(self, '_transform_%s' % type_name)(
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/transform.py", line 299, in _transform_list
    self._transform_parameters(
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/transform.py", line 260, in _transform_parameters
    getattr(self, '_transform_%s' % type_name)(
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/transform.py", line 285, in _transform_map
    params[key] = transformation(value)
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/types.py", line 271, in deserialize
    return deserializer(value[dynamodb_type])
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/types.py", line 301, in _deserialize_m
    return dict([(k, self.deserialize(v)) for k, v in value.items()])
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/types.py", line 301, in <listcomp>
    return dict([(k, self.deserialize(v)) for k, v in value.items()])
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/types.py", line 271, in deserialize
    return deserializer(value[dynamodb_type])
  File "/opt/homebrew/lib/python3.9/site-packages/boto3/dynamodb/types.py", line 280, in _deserialize_n
    return DYNAMODB_CONTEXT.create_decimal(value)
decimal.Rounded: [<class 'decimal.Rounded'>]

Expected behavior

The backfill script populates elastic search

Reproduction steps

  1. upgrade to transformer 2
  2. run the backfill script

GraphQL schema(s)

# Put schemas below this line


Log output

# Put your logs below this line


Additional information

No response

CodySwannGT avatar May 03 '22 00:05 CodySwannGT