Skip to content

storage list: PROVIDER column blank for S3 credentials (reads 'provider', API returns 'type') #6

Description

@gdameneses

Summary

urlbox storage list and storage show render an empty PROVIDER column for a fully configured S3 credential, because the label lookup reads provider while the API returns the kind in type.

Reproduce

  1. Have an org with an S3 storage credential (bucket, region, key/secret all set, assigned to a project).

  2. List it:

    urlbox storage list

Expected

│ BUCKET   │ ID         │ PROVIDER │ … │
│ my-bucket│ store_xxx  │ AWS S3   │ … │

Actual

PROVIDER is blank:

┌───────────┬────────────┬──────────┬──────────┬─────────┬──────────┐
│ BUCKET    │ ID         │ PROVIDER │ ENDPOINT │ KEY     │ ASSIGNED │
├───────────┼────────────┼──────────┼──────────┼─────────┼──────────┤
│ my-bucket │ store_xxx  │          │          │ AKIA…NN │ 1        │
└───────────┴────────────┴──────────┴──────────┴─────────┴──────────┘

This is not an unconfigured account — the credential works and is assigned to a project. The JSON shows why:

{
  "bucket": "my-bucket",
  "id": "store_xxx",
  "provider": null,
  "type": "s3",
  "region": "eu-west-2"
}

provider is null; the kind lives in type.

Cause

internal/cmd/storage.go:141:

func storageProviderLabel(c map[string]any) string {
	provider := valueOrEmpty(c["provider"])
	if valueOrEmpty(c["type"]) == "azure" {
		provider = "azure"
	}
	if label, ok := storageProviderLabels[provider]; ok {
		return label
	}
	return provider
}

It reads c["provider"], and only falls back to type for the single azure case. The label map is keyed on create-time slugs (aws_s3, google_cloud_storage, cloudflare_r2, …), so the API's type: "s3" matches nothing and the function returns "".

Open question

Which field is canonical? The create command takes --provider aws_s3, but this record (created via the dashboard) has provider: null / type: "s3". If both can be populated depending on origin, the label function needs to consult type generally — not just for azure — with a mapping from API type values (s3, gcs, r2, …) to the display labels. Flagging rather than patching, since the right mapping depends on what the API guarantees.

Environment

urlbox 1.2.0 (commit 5530665), Linux.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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