REST API POST to /v2/snaps with unknown snap results in 500 "Internal Server Error"

Bug #2024858 reported by Mitch Burton
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Fix Committed
Undecided
Zeyad Gouda

Bug Description

Making a POST request to the Snapd REST API with a snap name that it cannot find results in a 500 error and an uninformative message:

# curl -sS --unix-socket /run/snapd.socket http://localhost/v2/snaps -X POST \
-d '{"action": "install", "snaps": ["spamandeggs", "hello"]}' -H "Content-Type: application/json" \
| jq
{
  "type": "error",
  "status-code": 500,
  "status": "Internal Server Error",
  "result": {
    "message": "store.SnapNotFound with 2 snaps"
  }
}

404 is probably a more valuable HTTP response code, but I'm more concerned that there's no indication of which snap was not found.

description: updated
Changed in snapd:
status: New → Confirmed
Zeyad Gouda (zeyadgouda)
Changed in snapd:
assignee: nobody → Zeyad Gouda (zeyadgouda)
status: Confirmed → In Progress
Revision history for this message
Zeyad Gouda (zeyadgouda) wrote :

Hello Mitch, This PR should fix this bug https://github.com/snapcore/snapd/pull/12945. Thank you for reporting!

Revision history for this message
Mitch Burton (mitchburton) wrote :

Awesome, thank you!

Zeyad Gouda (zeyadgouda)
Changed in snapd:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.