Skip to content

bug(dashboard): list and view fail when org is auto-detected from DSN #447

@betegon

Description

@betegon

Summary

sentry dashboard list and sentry dashboard view fail with unhelpful 404/403 errors when the org is auto-detected from a DSN, while sentry dashboard create works correctly in the same environment.

From #406.

Reproduction

# Fails — org auto-detected from DSN resolves to numeric org ID
sentry dashboard list
# Error: API request failed: 404 Not Found

sentry dashboard view 505818
# Error: API request failed: 403 Forbidden

# Works — explicit org slug
sentry dashboard list sentry/
sentry dashboard view sentry/ 505818

# Also works — create uses a different (correct) resolution path
sentry dashboard create 'Test Dashboard'

Root cause

list and view use resolveOrgFromTargetresolveOrgresolveOrgFromDsn, which falls back to the numeric org ID from the DSN (e.g., "1" extracted from o1.ingest.us.sentry.io) when there's no cached project entry (resolve-target.ts:230).

create uses resolveAllTargetsresolveDsnToTarget, which does a full project API lookup and correctly resolves the org slug (e.g., "sentry").

The dashboard API endpoints reject the numeric org ID with 404 or 403.

Suggested fix

Make list and view use the same resolution path as create (resolveAllTargets), or improve resolveOrgFromDsn to resolve numeric org IDs to slugs (similar to what resolveEffectiveOrg does in region.ts).

Key files

  • src/commands/dashboard/resolve.ts:36-42resolveOrgFromTarget calls resolveOrg
  • src/lib/resolve-target.ts:808-836resolveOrg falls back to resolveOrgFromDsn
  • src/lib/resolve-target.ts:228-232resolveOrgFromDsn returns numeric org ID as fallback
  • src/commands/dashboard/create.ts:124-138create uses resolveAllTargets (correct path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions