erlef / rebar3_hex

Rebar3 Hex library
Apache License 2.0
101 stars 49 forks source link

Can't publish package #81

Closed ostinelli closed 5 years ago

ostinelli commented 5 years ago

When trying to publish my rebar3_vendor plugin, I'm getting the following error:

$ rebar3 hex publish
===> Verifying dependencies...
escript: exception error: no function clause matching 
                 rebar3_hex_publish:format_error(no_write_key) (/Users/roberto/.cache/rebar3/plugins/rebar3_hex/src/rebar3_hex_publish.erl, line 55)
  in function  rebar3:handle_error/2 (/opt/rebar3-3.7.5/src/rebar3.erl, line 339)
  in call from escript:run/2 (escript.erl, line 760)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1 
  in call from init:do_boot/3 

Using Erlang 19.3 and latest rebar3. Any ideas on what I might be doing wrong?

ferd commented 5 years ago

Have you first tried upgrading the rebar3 hex plugin? Latest rebar3 changes version of the package index, and so the plugin needs updating as well.

ostinelli commented 5 years ago

I've deleted the ~/.cache/rebar3 directory and rerun rebar3, should I take other steps?

ostinelli commented 5 years ago

Just to be on the safe side:

$ rebar3 plugins upgrade rebar3_hex
===> Fetching rebar3_hex ({pkg,<<"rebar3_hex">>,<<"6.0.0">>})
===> Version cached at /Users/roberto/.cache/rebar3/hex/hexpm/packages/rebar3_hex-6.0.0.tar is up to date, reusing it
===> Fetching hex_core ({pkg,<<"hex_core">>,<<"0.2.0">>})
===> Version cached at /Users/roberto/.cache/rebar3/hex/hexpm/packages/hex_core-0.2.0.tar is up to date, reusing it
===> Compiling hex_core
===> Compiling rebar3_hex

$ rebar3 hex publish
===> Verifying dependencies...
escript: exception error: no function clause matching 
                 rebar3_hex_publish:format_error(no_write_key) (/Users/roberto/.cache/rebar3/plugins/rebar3_hex/src/rebar3_hex_publish.erl, line 55)
  in function  rebar3:handle_error/2 (/opt/rebar3-3.7.5/src/rebar3.erl, line 339)
  in call from escript:run/2 (escript.erl, line 760)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1 
  in call from init:do_boot/3 
tsloughter commented 5 years ago

@ostinelli thanks, I definitely need to fix the format error handling. But looks like you simply need to authenticate again rebar3 hex auth.

ostinelli commented 5 years ago

Thank you for looking into this. A little better... :)

$ rebar3 hex user auth
Username: ([])> 
Account Password: 
You have authenticated on Hex using your account password. However, Hex requires you to have a local password that applies only to this machine for security purposes. Please enter it.
Local Password: 
Local Password (confirm): 
Generating all keys...

$ rebar3 hex publish
===> Verifying dependencies...
===> Using deprecated rebar_utils:vcs_vsn/3. Please upgrade your plugins.
Publishing rebar3_vendor 0.4.0 to hexpm
  Description: Rebar3 plugin for vendoring dependencies.
  Dependencies:

  Included files:
    /Users/roberto/workspace/rebar3_vendor/LICENSE.md
    /Users/roberto/workspace/rebar3_vendor/README.md
    /Users/roberto/workspace/rebar3_vendor/rebar.config
    /Users/roberto/workspace/rebar3_vendor/rebar.lock
    /Users/roberto/workspace/rebar3_vendor/src/rebar3_prv_vendor_apply.erl
    /Users/roberto/workspace/rebar3_vendor/src/rebar3_prv_vendor_store.erl
    /Users/roberto/workspace/rebar3_vendor/src/rebar3_vendor.erl
  Maintainers:
    Roberto Ostinelli
  Licenses: MIT
  Links:
    Github: http://github.com/ostinelli/rebar3_vendor
  Build tools: rebar3
Be aware, you are publishing to the public Hexpm repository.
Before publishing, please read Hex CoC: https://hex.pm/policies/codeofconduct
Proceed? ("Y")> y
Local Password: 
===> Uncaught error: {case_clause,
                                {ok,{400,
                                     #{<<"alt-svc">> => <<"clear">>,
                                       <<"cache-control">> =>
                                           <<"max-age=0, private, must-revalidate">>,
                                       <<"content-length">> => <<"50">>,
                                       <<"content-type">> =>
                                           <<"application/vnd.hex+erlang; charset=utf-8">>,
                                       <<"date">> =>
                                           <<"Thu, 29 Nov 2018 16:44:12 GMT">>,
                                       <<"server">> => <<"Cowboy">>,
                                       <<"strict-transport-security">> =>
                                           <<"max-age=31536000">>,
                                       <<"vary">> => <<"accept-encoding">>,
                                       <<"via">> => <<"1.1 google">>,
                                       <<"x-ratelimit-limit">> => <<"500">>,
                                       <<"x-ratelimit-remaining">> =>
                                           <<"499">>,
                                       <<"x-ratelimit-reset">> =>
                                           <<"1543509900">>,
                                       <<"x-request-id">> =>
                                           <<"2llqc25edk22mquvc401220h">>},
                                     #{<<"message">> => <<"Bad request">>,
                                       <<"status">> => 400}}}}

What can I try?

tsloughter commented 5 years ago

I'm checking with Eric to see if he can tell on the server end what was bad about the request.

tsloughter commented 5 years ago

Nothing found in the logs he says.

One option is to give me temporary permission to publish rebar3_vendor and I can try to debug.

Other option is to try moving back to 5.0.0 rebar3_hex.

tsloughter commented 5 years ago

Oops, haha, forgot I published this originally :).

I'll give it a try and debug whats going on.

tsloughter commented 5 years ago

@ostinelli so I accidentally published 0.4.0 with rebar3_hex 4.1.0 :)

But I was able to reproduce the 400 after that, so I can investigate and the new vendor plugin is published.

tsloughter commented 5 years ago

@ostinelli I published rebar3_hex 6.1.0 and it worked for me to publish rebar3_vendor, so should be good now.

ostinelli commented 5 years ago

lol I forgot that too. :) Thank you @tsloughter!