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

Issue with default region on Localstack 1.1 #284

Open
bianchim opened this issue Sep 5, 2022 · 0 comments
Open

Issue with default region on Localstack 1.1 #284

bianchim opened this issue Sep 5, 2022 · 0 comments

Comments

@bianchim
Copy link

bianchim commented Sep 5, 2022

Actual Behaviour

Using the plugin has become impossible as of late due to a hardcoded value 'localhost' as the region when initializing the plugin :
https://github.com/99x/serverless-dynamodb-local/blob/v1/index.js#L192

When starting the stack ( Localstack + serverless) I get an error :
'localhost' is not a valid AWS region name for dynamodb

This is thrown by boto3 when trying to resolve the DynamoDB enpoint and region locally.

Steps to reproduce it

Use Localstack 1.1.0, Serverless v3, and this plugin for migration and seeding.

Logs for the issue

The error message appears in every call, here's one of them :

localstack_1 | 2022-09-05T12:41:30.713 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain localstack_1 | Traceback (most recent call last): localstack_1 | File "/opt/code/localstack/localstack/aws/chain.py", line 57, in handle localstack_1 | handler(self, self.context, response) localstack_1 | File "/opt/code/localstack/localstack/aws/handlers/service.py", line 122, in __call__ localstack_1 | handler(chain, context, response) localstack_1 | File "/opt/code/localstack/localstack/aws/handlers/service.py", line 92, in __call__ localstack_1 | skeleton_response = self.skeleton.invoke(context) localstack_1 | File "/opt/code/localstack/localstack/aws/skeleton.py", line 153, in invoke localstack_1 | return self.dispatch_request(context, instance) localstack_1 | File "/opt/code/localstack/localstack/aws/skeleton.py", line 165, in dispatch_request localstack_1 | result = handler(context, instance) or {} localstack_1 | File "/opt/code/localstack/localstack/aws/forwarder.py", line 56, in _call localstack_1 | return handler(context, req) localstack_1 | File "/opt/code/localstack/localstack/aws/skeleton.py", line 117, in __call__ localstack_1 | return self.fn(*args, **kwargs) localstack_1 | File "/opt/code/localstack/localstack/services/dynamodb/provider.py", line 471, in describe_table localstack_1 | global_table_region: str | None = find_global_table_region( localstack_1 | File "/opt/code/localstack/localstack/services/dynamodb/provider.py", line 285, in find_global_table_region localstack_1 | replicas = get_store().REPLICA_UPDATES.get(table_name) localstack_1 | File "/opt/code/localstack/localstack/services/dynamodb/provider.py", line 275, in get_store localstack_1 | return dynamodb_stores[_account_id][_region] localstack_1 | File "/opt/code/localstack/localstack/services/stores.py", line 166, in __getitem__ localstack_1 | raise ValueError( localstack_1 | ValueError: 'localhost' is not a valid AWS region name for dynamodb

Would you like to work on the issue?

I have only done a minor fix for my use case in a fork, but it may need a bit more work to make it configurable.

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

No branches or pull requests

1 participant