Skip to content

aptly-api.service crashes when publishing to non-existing filesystem-publish-endpoint #1477

@JupiterRider

Description

@JupiterRider

Hey @neolynx ,

I installed aptly-api (Version 1.6.2) on a Debian system and when using the API to publish a snapshot, the aptly-api.service crashes when specifying a non-existing filesystem-publish-endpoint:

journalctl log:

Aug 08 21:23:04 deb13vm systemd[1]: aptly-api.service: Failed with result 'exit-code'.
Aug 08 21:23:04 deb13vm systemd[1]: aptly-api.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Aug 08 21:23:04 deb13vm aptly[7300]:         /__w/aptly/aptly/task/list.go:53 +0x26
Aug 08 21:23:04 deb13vm aptly[7300]: created by github.com/aptly-dev/aptly/task.(*List).consumer in goroutine 12
Aug 08 21:23:04 deb13vm aptly[7300]:         /__w/aptly/aptly/task/list.go:54 +0x43
Aug 08 21:23:04 deb13vm aptly[7300]: github.com/aptly-dev/aptly/task.(*List).consumer.func1()
Aug 08 21:23:04 deb13vm aptly[7300]:         /__w/aptly/aptly/api/api.go:173 +0x12c
Aug 08 21:23:04 deb13vm aptly[7300]: github.com/aptly-dev/aptly/api.runTaskInBackground.func1({0x5584fd69ad40?, 0xc0004c2160?}, 0xc0004c2170?)
Aug 08 21:23:04 deb13vm aptly[7300]:         /__w/aptly/aptly/api/publish.go:350 +0x845
Aug 08 21:23:04 deb13vm aptly[7300]: github.com/aptly-dev/aptly/api.apiPublishRepoOrSnapshot.func1({0x5584fd69ad40, 0xc0004c2160}, 0xc0004c2170)
Aug 08 21:23:04 deb13vm aptly[7300]:         /__w/aptly/aptly/deb/publish.go:817 +0x7f
Aug 08 21:23:04 deb13vm aptly[7300]: github.com/aptly-dev/aptly/deb.(*PublishedRepo).Publish(0xc0003c0120, {0x5584fd698460, 0xc0003f6b00}, {0x5584fd67a580?, 0xc0002e6000?}, 0xc0000c0370, {0x5584fd698370, 0xc0003a1cc0}, {0x5584fd69aaa0, 0xc0003ba4e0}, ...)
Aug 08 21:23:04 deb13vm aptly[7300]:         /__w/aptly/aptly/context/context.go:421 +0xcb7
Aug 08 21:23:04 deb13vm aptly[7300]: github.com/aptly-dev/aptly/context.(*AptlyContext).GetPublishedStorage(0xc0002e6000, {0xc000536be2, 0xe})
Aug 08 21:23:04 deb13vm aptly[7300]:         /__w/aptly/aptly/context/context.go:76 +0x8e
Aug 08 21:23:04 deb13vm aptly[7300]: github.com/aptly-dev/aptly/context.Fatal({0x5584fd67a508, 0xc0004c2310})
Aug 08 21:23:04 deb13vm aptly[7300]: goroutine 13 [running]:
Aug 08 21:23:04 deb13vm aptly[7300]: panic: (*context.FatalError) 0xc000010dc8
Aug 08 21:23:03 deb13vm aptly[7300]: openpgp: ?-bit EdDSA key, ID BABFF3FF90D80744, created 2025-08-08
Aug 08 21:23:03 deb13vm aptly[7300]: openpgp: Passphrase is required to unlock private key "deb13usr <deb13usr@local.corp>"
Aug 08 21:23:03 deb13vm aptly[7300]: opengpg: failure opening keyring '/var/lib/aptly-api/.gnupg/pubring.gpg': open /var/lib/aptly-api/.gnupg/pubring.gpg: no such file or directory
Aug 08 21:22:51 deb13vm aptly[7300]: Starting web server at: localhost:8080 (press Ctrl+C to quit)...
Aug 08 21:22:51 deb13vm systemd[1]: Started aptly-api.service - Aptly REST API.

API Client Code:

def publish():
    body = {
        "Signing": {
            "Passphrase": "123",
            "SecretKeyring": "/tmp/private.gpg",
        },
        "SourceKind": "snapshot",
        "Sources": [
            {
                "Name": "vscodium1"
            },
        ],
    }

    url = "http://localhost:8080/api/publish/filesystem:foo:debs"

    resp = requests.post(url, json=body)

The "foo" endpoint does not exist, but the aptly-api service should not crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions