AWS NoSQL Workbench - ValueError:“localhost”不是 dynamodb 的有效 AWS 区域名称

问题描述 投票:0回答:1

我使用 AWS NoSQL Workbench 查看我的 DynamoDBLocal 表。
我可以连接到我的 DynamoDBLocal 并列出我拥有的表的名称,但是当我想查看任何表的内容时,我会得到此堆栈跟踪:

2022-08-11T08:22:12.749 ERROR --- [   asgi_gw_2] l.aws.handlers.logging     : exception during call chain
Traceback (most recent call last):
  File "/opt/code/localstack/localstack/aws/chain.py", line 57, in handle
    handler(self, self.context, response)
  File "/opt/code/localstack/localstack/aws/handlers/service.py", line 121, in __call__
    handler(chain, context, response)
  File "/opt/code/localstack/localstack/aws/handlers/legacy.py", line 81, in __call__
    result = self.forward_request(
  File "/opt/code/localstack/localstack/aws/handlers/legacy.py", line 141, in forward_request
    return do_forward_request(
  File "/opt/code/localstack/localstack/services/edge.py", line 225, in do_forward_request
    result = do_forward_request_inmem(api, method, path, data, headers, port=port)
  File "/opt/code/localstack/localstack/services/edge.py", line 249, in do_forward_request_inmem
    response = modify_and_forward(
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 604, in wrapper
    value = func(*args, **kwargs)
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 684, in modify_and_forward
    listener_result = listener.forward_request(
  File "/opt/code/localstack/localstack/http/adapters.py", line 51, in forward_request
    response = self.request(request)
  File "/opt/code/localstack/localstack/aws/proxy.py", line 46, in request
    return self.skeleton.invoke(context)
  File "/opt/code/localstack/localstack/aws/skeleton.py", line 153, in invoke
    return self.dispatch_request(context, instance)
  File "/opt/code/localstack/localstack/aws/skeleton.py", line 165, in dispatch_request
    result = handler(context, instance) or {}
  File "/opt/code/localstack/localstack/aws/forwarder.py", line 55, in _call
    return handler(context, req)
  File "/opt/code/localstack/localstack/aws/skeleton.py", line 117, in __call__
    return self.fn(*args, **kwargs)
  File "/opt/code/localstack/localstack/services/dynamodb/provider.py", line 439, in describe_table
    table_props = get_store(context).table_properties.get(table_name)
  File "/opt/code/localstack/localstack/services/dynamodb/provider.py", line 295, in get_store
    return dynamodb_stores[_account_id][_region]
  File "/opt/code/localstack/localstack/services/stores.py", line 162, in __getitem__
    raise ValueError(
ValueError: 'localhost' is not a valid AWS region name for dynamodb
2022-08-11T08:22:12.749  INFO --- [   asgi_gw_2] localstack.request.aws     : AWS dynamodb.DescribeTable => 500 (InternalError)

但是当我使用 cli 时它就可以工作了:

aws dynamodb scan --table-name my_table --endpoint-url http://localhost:my_port
workbench dynamo-local
1个回答
0
投票

对我来说,

ALLOW_NONSTANDARD_REGIONS=1
有帮助。

  localstack:
    image: localstack/localstack:latest
    environment:
      # https://docs.localstack.cloud/references/configuration/
      - SERVICES=sqs,sns,dynamodb
      - DEFAULT_REGION=us-east-1
      - ALLOW_NONSTANDARD_REGIONS=1
      # - USE_SINGLE_REGION=1
      - LOCALSTACK_PERSISTENCE=1
      - EDGE_PORT=4566
      - DEBUG=1
    ports:
      - '4566-4597:4566-4597'
    volumes:
      - localstack-data:/var/lib/localstack
      - /var/run/docker.sock:/var/run/docker.sock
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.