localstack icon indicating copy to clipboard operation
localstack copied to clipboard

bug: ECR repositories not describing

Open rogerfar opened this issue 9 months ago • 2 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Current Behavior

When creating a new ECR repository (from either command line or through app.localstack.cloud, it looks good.

But when trying to describe, open or delete the repository it throws an exception:

2025-04-08T19:35:36.939  INFO --- [et.reactor-1] l.request.internal.aws     : AWS ecr.DescribeRepositories => 200
2025-04-08T19:35:36.939 ERROR --- [et.reactor-0] l.aws.handlers.logging     : exception during call chain
Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/rolo/gateway/chain.py", line 166, in handle
    handler(self, self.context, response)
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/aws/handlers/service.py", line 113, in __call__
    handler(chain, context, response)
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/aws/handlers/service.py", line 83, in __call__
    skeleton_response = self.skeleton.invoke(context)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/aws/skeleton.py", line 154, in invoke
    return self.dispatch_request(serializer, context, instance)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/aws/skeleton.py", line 168, in dispatch_request
    result = handler(context, instance) or {}
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/aws/forwarder.py", line 133, in _call
    return handler(context, req)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/aws/skeleton.py", line 118, in __call__
    return self.fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/services/ecr/provider.py.enc", line 92, in describe_images
    F=next_token;E=image_ids;D=repository_name;B=registry_id;A=context;B=B or A.account_id;C._check_if_repository_exists(registry_id=B,region=A.region,repository_name=D);H=C.registries.get((B,A.region));I=ecr_stores[A.account_id][A.region];J=PaginatedList(C._describe_images(I,registry=H,repository_name=D));G,F=J.get_page(token_generator=lambda item:item[_B],next_token=F,page_size=max_results,filter_function=C._describe_image_filter(E))
                                                                                                                                                                                                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/services/ecr/provider.py.enc", line 169, in _describe_images
    C=repository_name;B=registry;E=A._get_tags_for_repository(registry=B,repository_name=C);F=[A._describe_image(store,registry=B,repository_name=C,tag=D)for D in E];D=[]
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/services/ecr/provider.py.enc", line 179, in _get_tags_for_repository
    A=registry;C=B._create_registry_client(A);D=C.repository(repository_name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/services/ecr/provider.py.enc", line 229, in _create_registry_client
    def _create_registry_client(registry):A=registry.url;return DockerRegistryClient(f"http://{A}",api_version=2)
                                            ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'url'

Expected Behavior

No response

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

docker run localstack/localstack
awslocal ecr create-repository --repository-name localstack-ecr-repository --region us-west-2 --registry-id 123456789
awslocal ecr list-images --repository-name localstack-ecr-repository --region us-west-2 --registry-id 123456789
awslocal ecr list-images --repository-name localstack-ecr-repository --region us-west-2

Go to https://app.localstack.cloud/inst/default/resources/ecr/repositories

Try to open the created repository.

Environment

OS: Windows 10
LocalStack version: 4.3.1.dev29
LocalStack build date: 2025-04-08
LocalStack build git hash: fbb32798a

Anything else?

No response

rogerfar avatar Apr 08 '25 19:04 rogerfar

Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.

localstack-bot avatar Apr 08 '25 19:04 localstack-bot

@rogerfar thank you for reaching out. We are currently looking into your issue and will notify you as soon as we have more information.

anisaoshafi avatar Apr 29 '25 13:04 anisaoshafi