Skip to content

spectrum lines command: H.map is not a function #70

Description

@lxlleo

Bug Description

The photon spectrum lines command fails with "H.map is not a function" on all CLI versions (0.3.3 through 1.1.0). The API returns valid JSON {"lines":[], "pendingRegistrations":[]}, but the minified response handler code expects H to be an array and calls .map() on it.

Steps to Reproduce

export PHOTON_PROJECT_ID=<any-project-id>
photon spectrum lines
# # H.map is not a function

Environment

  • OS: macOS
  • Node: v22.23.1
  • CLI Version: 1.1.0 (also reproduced on 0.3.3, 0.4.0, 1.0.0)
  • API Response: {"lines":[], "pendingRegistrations":[]} (HTTP 200)

Root Cause

The minified photon.js file contains response handling logic for spectrum lines list where a variable H holds the API response object. The code then does H.map(...) expecting H to be an array, but H is the full response object {lines: [], pendingRegistrations: []}. The array is in H.lines not H itself.

Workaround

Direct API call via curl works fine:

curl "https://app.photon.codes/api/projects/$PHOTON_PROJECT_ID/lines" \
  -H "Authorization: Bearer $TOKEN"
# {"lines":[], "pendingRegistrations":[]}

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