When asking to release to a branch that's too long, a traceback is printed that gives no hints as to the source of the error.

Bug #1750177 reported by John Lenton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snap Store Server
Fix Released
Undecided
Maximiliano Bertacchini
Snapcraft
Fix Released
High
Kyle Fazzari

Bug Description

(I think it's looking for an 'errors' key in the response that isn't there)

$ snapcraft release interdenominational-counterintelligences 1 'stable/It-was-the-best-of-times--it-was-the-worst-of-times--it-was-the-age-of-wisdom--it-was-the-age-of-foolishness--it-was-the-epoch-of-belief--it-was-the-epoch-of-incredulity--it-was-the-season-of-Light--it-was-the-season-of-Darkness--it-was-the-spring-of-hope--it-was-the-winter-of-despair'
Traceback (most recent call last):
  File "/snap/snapcraft/1094/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.39', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/1094/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/snap/snapcraft/1094/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/1094/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/1094/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 43, in <module>
    run(prog_name='snapcraft')
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/cli/store.py", line 210, in release
    snapcraft.release(snap_name, revision, channels.split(','))
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/_store.py", line 607, in release
    channels = store.release(snap_name, revision, release_channels)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/storeapi/_store_client.py", line 156, in release
    self.sca.snap_release, snap_name, revision, channels)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/storeapi/_store_client.py", line 78, in _refresh_if_necessary
    return func(*args, **kwargs)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/storeapi/_sca_client.py", line 176, in snap_release
    raise errors.StoreReleaseError(data['name'], response)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/storeapi/errors.py", line 353, in __init__
    self.fmt = fmt_error(response)
  File "/snap/snapcraft/1094/lib/python3.6/site-packages/snapcraft/storeapi/errors.py", line 395, in __fmt_error_unknown
    fmt = '{errors}'.format(**response_json)
KeyError: 'errors'

Tags: stacktrace
Cris Dywan (kalikiana)
tags: added: stacktrace
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

The response from the store isn't json in this case, it's HTML, which isn't what snapcraft expects. We should fix the traceback, but can the store folks please make sure this error case is properly handled and give us a proper json error response? Adding a task for snapstore as well.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

The snapcraft bit of this is proposed here: https://github.com/snapcore/snapcraft/pull/2059

Changed in snapcraft:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Kyle Fazzari (kyrofa)
Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
Changed in snapstore:
status: New → In Progress
assignee: nobody → Maximiliano Bertacchini (maxiberta)
Changed in snapstore:
status: In Progress → Fix Committed
Revision history for this message
Maximiliano Bertacchini (maxiberta) wrote :

Store now validates branch name length, and snapcraft shows the error message correctly (currently deployed on staging store):

    $ snapcraft release htop-snap 1 'stable/It-was-the-best-of-times--it-was-the-worst-of-times--it-was-the-age-of-wisdom--it-was-the-age-of-foolishness--it-was-the-epoch-of-belief--it-was-the-epoch-of-incredulity--it-was-the-season-of-Light--it-was-the-season-of-Darkness--it-was-the-spring-of-hope--it-was-the-winter-of-despair'
    invalid-field: Invalid branch name: It-was-the-best-of-times--it-was-the-worst-of-times--it-was-the-age-of-wisdom--it-was-the-age-of-foolishness--it-was-the-epoch-of-belief--it-was-the-epoch-of-incredulity--it-was-the-season-of-Light--it-was-the-season-of-Darkness--it-was-the-spring-of-hope--it-was-the-winter-of-despair. Ensure this value has at most 128 characters (it has 285).

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Thank you, Maximiliano! Looks great :) .

Changed in snapstore:
status: Fix Committed → Fix Released
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.