canonical / charmcraft

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.
Apache License 2.0
64 stars 66 forks source link

`fetch-libs` crashes with an internal error #1681

Closed jdkandersson closed 3 weeks ago

jdkandersson commented 1 month ago

Bug Description

After logging in and running fetch-libs, there is an internal error charmcraft internal error: StoreServerError("Store operation failed:\n- None: Items need to include 'library_id' or 'package_id'")

To Reproduce

  1. Create a multipass VM
  2. Install latest/edge of charmcraft
  3. Include a charm-libs entry such as:
charm-libs:
  - lib: observability_libs.juju_topology
    version: 0
  1. run fetch-libs

Environment

arm64 ubuntu jammy, charmcraft on latest/edge

charmcraft.yaml

# This file configures Charmcraft.
# See https://juju.is/docs/sdk/charmcraft-config for guidance.

name: sample-flask

type: charm

bases:
  - build-on:
    - name: ubuntu
      channel: "22.04"
    run-on:
    - name: ubuntu
      channel: "22.04"

# (Required)
summary: A very short one-line summary of the flask application.

# (Required)
description: |
  A comprehensive overview of your Flask application.

extensions:
  - flask-framework

charm-libs:
  - lib: observability_libs.juju_topology
    version: 0

# Uncomment the integrations used by your application
# requires:
#   mysql:
#     interface: mysql_client
#     limit: 1
#   postgresql:
#     interface: postgresql_client
#     limit: 1

Relevant log output

cat /home/ubuntu/.local/state/charmcraft/log/charmcraft-20240509-174417.997582.log
2024-05-09 17:44:17.998 Starting charmcraft, version 3.0.0.post39+ge2ad204
2024-05-09 17:44:17.998 Log verbosity level set to BRIEF
2024-05-09 17:44:17.998 Configuring application...
2024-05-09 17:44:17.998 Preparing application...
2024-05-09 17:44:17.998 Build plan: platform=None, build_for=None
2024-05-09 17:44:17.998 Loading project file '/home/ubuntu/src/sample-flask/charm/charmcraft.yaml'
2024-05-09 17:44:18.000 Processing grammar (on arm64 for arm64)
2024-05-09 17:44:18.000 Processing grammar for plugin: charm
2024-05-09 17:44:18.000 Processing grammar for source: .
2024-05-09 17:44:18.000 Running charmcraft fetch-libs on host
2024-05-09 17:44:18.000 Setting up StoreService
2024-05-09 17:44:18.074 Falling back to file based storage
2024-05-09 17:44:18.074 Getting library metadata from charmhub
2024-05-09 17:44:18.074 Retrieving credentials for 'charmcraft' on 'api.charmhub.io' from keyring 'auth FileKeyring'.
2024-05-09 17:44:18.074 HTTP 'POST' for 'https://api.charmhub.io/v1/charm/libraries/bulk' with params None and headers {'Authorization': '<macaroon>', 'User-Agent': 'Charmcraft/3.0.0.post39+ge2ad204 (Linux 5.15.0-106-generic; aarch64; CPython 3.10.12; Ubuntu 22.04)'}
2024-05-09 17:44:18.258 charmcraft internal error: StoreServerError("Store operation failed:\n- None: Items need to include 'library_id' or 'package_id'")
2024-05-09 17:44:18.265 Traceback (most recent call last):
2024-05-09 17:44:18.265   File "/snap/charmcraft/3739/lib/python3.10/site-packages/craft_application/application.py", line 517, in run
2024-05-09 17:44:18.265     return_code = dispatcher.run() or 0
2024-05-09 17:44:18.265   File "/snap/charmcraft/3739/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run
2024-05-09 17:44:18.265     return self._loaded_command.run(self._parsed_command_args)
2024-05-09 17:44:18.265   File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/application/commands/store.py", line 1679, in run
2024-05-09 17:44:18.265     libs_metadata = store.get_libraries_metadata_by_name(charm_libs)
2024-05-09 17:44:18.265   File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/services/store.py", line 220, in get_libraries_metadata_by_name
2024-05-09 17:44:18.265     for lib in self.get_libraries_metadata(libraries)
2024-05-09 17:44:18.265   File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/services/store.py", line 212, in get_libraries_metadata
2024-05-09 17:44:18.265     return self.client.fetch_libraries_metadata(store_libs)
2024-05-09 17:44:18.265   File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/store/client.py", line 202, in fetch_libraries_metadata
2024-05-09 17:44:18.265     response = self.request_urlpath_json("POST", "/v1/charm/libraries/bulk", json=libs)
2024-05-09 17:44:18.265   File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/store/client.py", line 134, in request_urlpath_json
2024-05-09 17:44:18.265     response = super().request(method, self.api_base_url + urlpath, *args, **kwargs)
2024-05-09 17:44:18.265   File "/snap/charmcraft/3739/lib/python3.10/site-packages/craft_store/base_client.py", line 186, in request
2024-05-09 17:44:18.265     return self.http_client.request(
2024-05-09 17:44:18.265   File "/snap/charmcraft/3739/lib/python3.10/site-packages/craft_store/http_client.py", line 166, in request
2024-05-09 17:44:18.265     raise errors.StoreServerError(response)
2024-05-09 17:44:18.265 craft_store.errors.StoreServerError: Store operation failed:
2024-05-09 17:44:18.265 - None: Items need to include 'library_id' or 'package_id'
2024-05-09 17:44:18.265 Full execution log: '/home/ubuntu/.local/state/charmcraft/log/charmcraft-20240509-174417.997582.log'
syncronize-issues-to-jira[bot] commented 1 month ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2903.

This message was autogenerated

gregory-schiano commented 1 month ago

This issue is related to my comment here: https://github.com/canonical/charmcraft/issues/1671#issuecomment-2099399294