Skip to content

Problem: Edit pipeline form resets API key #1789

@replaceafill

Description

@replaceafill

Expected behaviour

When editing a pipeline in the Storage Service, leaving the API key field blank on form submission should preserve the existing value instead of overwriting it.

Current behaviour

When the API key field is left blank and the form is submitted, the existing value is overwritten with an empty string.

Steps to reproduce

  1. Start an AIP reingest from either the Archivematica Dashboard or the Storage Service.
  2. Confirm that a new Approve AIP reingest job appears in the Ingest tab of the Dashboard. This shows that the Storage Service can successfully authenticate with the pipeline.
  3. In the Storage Service, go to the Pipelines tab and click Edit for a pipeline.
  4. Beware: submitting this form with a blank API key field will erase the existing API key value.
  5. Change the pipeline Description, leaving the API key field blank, then click Edit Pipeline.
  6. Start another AIP reingest in the edited pipeline.
  7. Notice that authentication now fails, either in the Storage Service UI or in the Storage Service logs.
DEBUG     2026-03-18 15:01:50  archivematica.storage_service.locations.models.pipeline:pipeline:_request_api:174:  URL: https://myserver.example.com/api/ingest/reingest; headers {'Authorization': 'ApiKey test:'}; data: {'name': 'tmphiku5h5y/reingest-test-e9bd5c80-4ec4-43ad-a868-8a065e5f642c', 'uuid': 'e9bd5c80-4ec4-43ad-a868-8a065e5f642c'}
DEBUG     2026-03-18 15:01:50  archivematica.storage_service.locations.models.pipeline:pipeline:_request_api:189:  Response: 403 {"message": "API key not valid.", "error": true}
ERROR     2026-03-18 15:01:50  archivematica.storage_service.locations.models.package:package:start_reingest:2369:  Error approving reingest in pipeline for package e9bd5c80-4ec4-43ad-a868-8a065e5f642c
Traceback (most recent call last):
  File "/opt/archivematica/archivematica-storage-service/src/archivematica/storage_service/locations/models/package.py", line 2366, in start_reingest
    resp = pipeline.reingest(relative_path, self.uuid, reingest_target)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archivematica/archivematica-storage-service/src/archivematica/storage_service/locations/models/pipeline.py", line 224, in reingest
    raise requests.exceptions.RequestException(
requests.exceptions.RequestException: Pipeline Archivematica on myserver (dc158f14-8f54-4276-91ca-8bcb05281479) returned an unexpected status code: 403 (API key not valid.)

Your environment (version of Archivematica, operating system, other relevant details)

artefactual/archivematica@0948311
artefactual/archivematica-storage-service@4f7d151

Found during a 1.18.0 upgrade.


For Artefactual use:

Before you close this issue, you must check off the following:

  • All pull requests related to this issue are properly linked
  • All pull requests related to this issue have been merged
  • A testing plan for this issue has been implemented and passed (testing plan information should be included in the issue body or comments)
  • Documentation regarding this issue has been written and merged (if applicable)
  • Details about this issue have been added to the release notes (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: reviewThe issue's code has been merged and is ready for testing/review.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions