Fails to publish: "This login method is not longer supported"
I use this action in a github worflow to publish a built snap, and (presumably) with the update of snapcraft to 7.0.4 the action started failing with the following error:
Run snapcore/action-publish@v1
with:
store_login: ***
snap: firefox_103.0a1_amd64.snap
release: edge
Publishing snap "firefox_103.0a1_amd64.snap"...
/snap/bin/snapcraft login --with /tmp/login-data-A4p4jN/login.txt
--with is no longer supported, export the auth to the environment variable 'SNAPCRAFT_STORE_CREDENTIALS' instead
Login successful
(node:53952) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
/snap/bin/snapcraft upload firefox_103.0a1_amd64.snap --release edge
This login method is not longer supported Traceback (most recent call last):
File "/snap/snapcraft/7664/bin/snapcraft", line 8, in <module>
sys.exit(run())
File "/snap/snapcraft/7664/lib/python3.8/site-packages/snapcraft/cli.py", line 179, in run
dispatcher.run()
File "/snap/snapcraft/7664/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 406, in run
return self._loaded_command.run(self._parsed_command_args)
File "/snap/snapcraft/7664/lib/python3.8/site-packages/snapcraft/commands/upload.py", line 89, in run
client.verify_upload(snap_name=snap_name)
File "/snap/snapcraft/7664/lib/python3.8/site-packages/snapcraft/commands/store/client.py", line 344, in verify_upload
self.request(
File "/snap/snapcraft/7664/lib/python3.8/site-packages/snapcraft/commands/store/client.py", line 217, in request
return self.store_client.request(*args, **kwargs)
File "/snap/snapcraft/7664/lib/python3.8/site-packages/craft_store/ubuntu_one_store_client.py", line 137, in request
self._refresh_token()
File "/snap/snapcraft/7664/lib/python3.8/site-packages/craft_store/ubuntu_one_store_client.py", line 70, in _refresh_token
macaroons = json.loads(self._auth.get_credentials())
File "/snap/snapcraft/7664/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/snap/snapcraft/7664/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/snap/snapcraft/7664/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
/snap/bin/snapcraft logout
This login method is not longer supported
Credentials cleared
Error: The process '/snap/bin/snapcraft' failed with exit code 1
Is this fixed with https://github.com/snapcore/action-publish/commit/7fe468c9de12396a9c8964af5d0dfd1d5b493bd7 ?
We just changed our workflow to:
- name: Publish to Snap Store
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_PUBLISH_CREDENTIALS }}
with:
snap: ${{ env.SNAP_PACKAGE_PATH }}
release: stable
We're no longer getting the This login method is not longer supported error, but instead we get this error:
Error: login_data is empty
We're no longer getting the
This login method is not longer supportederror, but instead we get this error:
The fix did not yet make it into a new release. Maybe try snapcore/action-publish@master.
snapcore/action-publish@master doesn't seem to work either. Using:
- uses: snapcore/action-publish@master
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_TOKEN }}
with:
snap: ${{ steps.build.outputs.snap }}
release: candidate
We're seeing:
Installing Snapcraft...
/usr/bin/sudo snap install --classic snapcraft
snapcraft 7.0.5 from Canonical* installed
/snap/bin/snapcraft upload doctl_v1.76.2+git8a0a2859_amd64.snap --release candidate
Traceback (most recent call last):
File "/snap/snapcraft/7687/bin/snapcraft", line 8, in <module>
sys.exit(run())
File "/snap/snapcraft/7687/lib/python3.8/site-packages/snapcraft/cli.py", line 180, in run
dispatcher.run()
File "/snap/snapcraft/7687/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 406, in run
return self._loaded_command.run(self._parsed_command_args)
File "/snap/snapcraft/7687/lib/python3.8/site-packages/snapcraft/commands/upload.py", line 89, in run
client.verify_upload(snap_name=snap_name)
File "/snap/snapcraft/7687/lib/python3.8/site-packages/snapcraft/commands/store/client.py", line 344, in verify_upload
self.request(
File "/snap/snapcraft/7687/lib/python3.8/site-packages/snapcraft/commands/store/client.py", line 217, in request
return self.store_client.request(*args, **kwargs)
File "/snap/snapcraft/7687/lib/python3.8/site-packages/craft_store/ubuntu_one_store_client.py", line 134, in request
response = super().request(method, url, params, headers, **kwargs)
File "/snap/snapcraft/7687/lib/python3.8/site-packages/craft_store/base_client.py", line 172, in request
headers["Authorization"] = self._get_authorization_header()
File "/snap/snapcraft/7687/lib/python3.8/site-packages/craft_store/ubuntu_one_store_client.py", line 58, in _get_authorization_header
macaroons = json.loads(self._auth.get_credentials())
File "/snap/snapcraft/7687/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/snap/snapcraft/7687/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/snap/snapcraft/7687/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
https://github.com/digitalocean/doctl/runs/6909286518?check_suite_focus=true#step:5:13
So it looks like the credential format has changed as well. After regenerating them with snapcraft export-login and updating the secret, it now works as expected. Previously, they looked like the screenshot in the README, a multi-line file starting with [login.ubuntu.com] . Now it is a single long string.
Thanks for the pointers @bjorn @andrewsomething . Using the @master version and re-exporting the credentials worked.
Just a suggestion: if possible it might be a good idea to pin the version of snapcraft that the action installs (https://github.com/snapcore/action-publish/blob/master/src/tools.ts#L35) so that breaking changes aren't automatically pulled in. I guess this might be tough to do with a snap install though.
Run snapcore/action-publish@v1
Publishing snap "google-chat-electron_2.16.2_amd64.snap"...
/snap/bin/snapcraft login --with /tmp/login-data-bbcgfG/login.txt
--with is no longer supported, export the auth to the environment variable 'SNAPCRAFT_STORE_CREDENTIALS' instead
Login successful
(node:34047) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
/snap/bin/snapcraft upload google-chat-electron_2.16.2_amd64.snap --release stable
This login method is not longer supported
craft-store error: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Full execution log: '/home/runner/.cache/snapcraft/log/snapcraft-20220623-060624.601932.log'
/snap/bin/snapcraft logout
This login method is not longer supported
Credentials cleared
Error: The process '/snap/bin/snapcraft' failed with exit code 1
This is scary that the this action is always going to install latest version of snapcraft which may break anytime.
When i tried to generate new token today, i see another error
> snapcraft --version
snapcraft 7.0.7
> snapcraft export-login --snaps=google-chat-electron \
--acls package_access,package_push,package_update,package_release \
exported.txt
This login method is not longer supported
Enter your Ubuntu One e-mail address and password.
If you do not have an Ubuntu One account, you can create one at https://snapcraft.io/account
Email: pro.ankurk1[at]gmail.com
Password:
Traceback (most recent call last):
File "/snap/snapcraft/7717/bin/snapcraft", line 8, in <module>
sys.exit(run())
File "/snap/snapcraft/7717/lib/python3.8/site-packages/snapcraft/cli.py", line 188, in run
dispatcher.run()
File "/snap/snapcraft/7717/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 406, in run
return self._loaded_command.run(self._parsed_command_args)
File "/snap/snapcraft/7717/lib/python3.8/site-packages/snapcraft/commands/account.py", line 217, in run
credentials = store.StoreClientCLI(ephemeral=True).login(**kwargs)
File "/snap/snapcraft/7717/lib/python3.8/site-packages/snapcraft/commands/store/client.py", line 187, in login
credentials = self.store_client.login(
File "/snap/snapcraft/7717/lib/python3.8/site-packages/snapcraft/commands/store/_legacy_account.py", line 149, in login
raise NotImplementedError("Cannot login with legacy")
NotImplementedError: Cannot login with legacy
This is not developer friendly :(
I can ensure that i entered correct password (ubuntu one).
P.S.
Tried to login with snapcraft login, but getting same error,
I updated my workflow yml according to readme.md
Run snapcore/action-publish@v1
with:
snap: google-chat-electron_[2](https://github.com/ankurk91/google-chat-electron/runs/7022740556?check_suite_focus=true#step:12:2).16.[3](https://github.com/ankurk91/google-chat-electron/runs/7022740556?check_suite_focus=true#step:12:3)_amd6[4](https://github.com/ankurk91/google-chat-electron/runs/7022740556?check_suite_focus=true#step:12:4).snap
release: stable
env:
SNAPCRAFT_STORE_CREDENTIALS: ***
Publishing snap "google-chat-electron_2.1[6](https://github.com/ankurk91/google-chat-electron/runs/7022740556?check_suite_focus=true#step:12:6).3_amd64.snap"...
Error: login_data is empty
Then i got this error, I have been struggling from past 4 hours. I will prefer to un-publish the existing snaps from store.
Then i got this error, I have been struggling from past 4 hours.
The fix has only been released 2 hours ago, and you referred to v1 instead of master, which is why you were still seeing Error: login_data is empty. Now that 1.1.1 is tagged, it should work with v1 as well.
@bjorn I have removed support for snaps from my desktop app, has unpublished the app from store as well.
I still get a Cannot parse config: File contains no section headers., because the exported login token contains no config line, only a token!
I already spend many hours in the last few days with this. The last thing I tried is to manually write a "secret" file snapcraft would expect, but the token doesn't work with it. I'll get a pymacaroons.exceptions.MacaroonDeserializationException: cannot determine data format of binary-encoded macaroon.
I'm giving up on snap too now.
@pbek Did you read this comment? You need to adjust both the use of this action to use the SNAPCRAFT_STORE_CREDENTIALS environment variable instead of the store_login parameter (as in https://github.com/mapeditor/tiled/commit/e79f4fe8ee98d0087f35cbfce21f6bfedfaf6d22, but you no longer need to use @master), as well as generate a credentials string in the new format using snapcraft export-login (using snapcraft 7).
@bjorn, thank you for your advice! I did all, but the @master, I'll try that with the next release! What is the content of SNAPCRAFT_STORE_CREDENTIALS? Just the base64 (?) encoded string snapcraft export-login --snaps=qownnotes --acls package_access,package_push,package_update,package_release - returns?
I thought after your comment...
Now that 1.1.1 is tagged, it should work with v1 as well.
... it would work with v1 two month later. 😅
@pbek Hmm, I would have thought the same, I just never got around to actually switch back to using v1... No idea why that wouldn't pick the same as master, with the v1.1.1 tag (and the v1 tag) pointing to the latest commit.
And what did you put into SNAPCRAFT_STORE_CREDENTIALS?
And what did you put into
SNAPCRAFT_STORE_CREDENTIALS?
Ah, I missed that question. Yes, just the string that snapcraft export-login ... outputs.
Using the master branch directly did work! Thank you very much! Do you think that should be documented in https://github.com/snapcore/action-publish/blob/0a8d537ae06f4a292e8b4ef1084cd5631b3c6871/README.md?plain=1#L35?
@oSoMoN So, seeing your changes, can you confirm that actually v1 is working now? I'm a bit confused with @pbek reporting it still only works with master.
@oSoMoN So, seeing your changes, can you confirm that actually
v1is working now? I'm a bit confused with @pbek reporting it still only works withmaster.
Yes, @v1 is working again for two snaps I maintain (0ad and firefox).
How strange. Switching to master was the only thing I did to make it work in the end. I'll try v1 again next time
v1 did indeed work for me!