Skip to content

Webhook URL derived from gateway URL via fragile string replace #70

Description

@magent-cryptograss

Problem

In delivery-kid/pinning-service/app/routes/content.py (line ~306), the Coconut webhook URL is derived from the IPFS gateway URL by stripping ipfs. from the hostname:

base_url = settings.ipfs_gateway_url.replace("ipfs.", "", 1)

So https://ipfs.delivery-kid.cryptograss.live becomes https://delivery-kid.cryptograss.live.

If the gateway URL format ever changes (different subdomain scheme, path-based routing, different domain entirely), the webhook URL silently goes nowhere and Coconut jobs complete into the void with no notification.

Proposed fix

Add a webhook_base_url (or public_base_url) config field to Settings. The webhook URL should be explicitly configured, not reverse-engineered from the gateway URL.

At minimum, add an assertion that the derived URL looks sane before using it:

assert base_url.startswith("https://"), f"Webhook base URL looks wrong: {base_url}"
assert "ipfs" not in base_url.split("/")[2], f"Webhook URL still contains 'ipfs': {base_url}"

Context

From PR #69 review. The Coconut webhook is how we learn that transcoding completed — if it doesn't fire, HLS outputs sit on Coconut's servers and we never pin them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions