erlef / rebar3_hex

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

function_clause when adding owner #117

Closed nalundgaard closed 5 years ago

nalundgaard commented 5 years ago

When adding an owner to my hex package with the latest 6.6.0 rebar3_hex plugin and rebar3 3.11.1, I get a function_clause error adding an owner:

$ DEBUG=1 rebar3 hex owner add erl_cache test@example.com
===> Evaluating config script "rebar.config.script"
===> Load global config file /Users/nal/.config/rebar3/rebar.config
===> 20.3.8.16 satisfies the requirement for minimum OTP version 18
===> Expanded command sequence to be run: []
===> Provider: {default,do}
===> Expanded command sequence to be run: [{hex,owner}]
===> Provider: {hex,owner}
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: function_clause
===> Stack trace to the error location:
[{hex_api_package_owner,add,
                        [#{api_key => undefined,api_organization => undefined,
                           api_repository => undefined,
                           api_url => <<"https://hex.pm/api">>,
                           http_adapter => r3_hex_http_httpc,
                           http_adapter_config => #{profile => rebar},
                           http_etag => undefined,
                           http_user_agent_fragment =>
                               <<"(rebar3/3.11.1) (httpc)">>,
                           name => <<"hexpm">>,
                           read_key => <<_>>,
                           repo_key => undefined,repo_name => <<"hexpm">>,
                           repo_organization => undefined,
                           repo_public_key =>
                               <<"-----BEGIN PUBLIC KEY-----\n____\n-----END PUBLIC KEY-----">>,
                           repo_url => <<"https://repo.hex.pm">>,
                           repo_verify => true,repo_verify_origin => true,
                           username => <<"nalundgaard@gmail.com">>,
                           write_key =>
                               {<<_>>,
                                {<<_>>,
                                 <<_>>}}},
                         "erl_cache","test@example.com"],
                        [{file,"/Users/nal/.cache/rebar3/plugins/hex_core/src/hex_api_package_owner.erl"},
                         {line,26}]},
 {rebar3_hex_owner,add,4,
                   [{file,"/Users/nal/.cache/rebar3/plugins/rebar3_hex/src/rebar3_hex_owner.erl"},
                    {line,69}]},
 {rebar3_hex_owner,handle_command,2,
                   [{file,"/Users/nal/.cache/rebar3/plugins/rebar3_hex/src/rebar3_hex_owner.erl"},
                    {line,42}]},
 {rebar_core,do,2,
             [{file,"/Users/nal/src/rebar3/src/rebar_core.erl"},{line,154}]},
 {rebar_prv_do,do_task,5,
               [{file,"/Users/nal/src/rebar3/src/rebar_prv_do.erl"},
                {line,87}]},
 {rebar_core,do,2,
             [{file,"/Users/nal/src/rebar3/src/rebar_core.erl"},{line,154}]},
 {rebar3,run_aux,2,[{file,"/Users/nal/src/rebar3/src/rebar3.erl"},{line,178}]},
 {rebar3,main,1,[{file,"/Users/nal/src/rebar3/src/rebar3.erl"},{line,66}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`

It seems like this is because the args are passed to hex_api_package_owner:add as strings, but that function, at least in hex_core 0.5.0, expects binaries via guards.

Other info:

rebar3 plugins list:

$ DEBUG=1 rebar3 plugins list
===> Evaluating config script "rebar.config.script"
===> Load global config file /Users/nal/.config/rebar3/rebar.config
===> 20.3.8.16 satisfies the requirement for minimum OTP version 18
===> Expanded command sequence to be run: []
===> Provider: {default,do}
===> Expanded command sequence to be run: [{plugins,list}]
===> Provider: {plugins,list}
--- Global plugins ---
rebar3_hex (6.6.0)

rebar3 report output:

$ rebar3 report "rebar3 hex owner add erl_cache test@example.com"
Rebar3 report
 version 3.11.1
 generated at 2019-06-17T16:24:36+00:00
=================
Please submit this along with your issue at https://github.com/erlang/rebar3/issues (and feel free to edit out private information, if any)
-----------------
Task: rebar3
Entered as:
  rebar3 hex owner add erl_cache test@example.com
-----------------
Operating System: x86_64-apple-darwin18.2.0
ERTS: Erlang/OTP 20 [erts-9.3.3.7] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [kernel-poll:false]
Root Directory: /Users/nal/bin/kerl.d/20.3.8.16
Library directory: /Users/nal/bin/kerl.d/20.3.8.16/lib
-----------------
Loaded Applications:
bbmustache: 1.6.1
certifi: 2.5.1
cf: 0.2.2
common_test: 1.15.4
compiler: 7.1.5.2
crypto: 4.2.2.2
cth_readable: 1.4.4
dialyzer: 3.2.4
edoc: 0.9.2
erlware_commons: 1.3.1
eunit: 2.3.5
eunit_formatters: 0.5.0
getopt: 1.0.1
hipe: 3.17.1
inets: 6.5.2.4
kernel: 5.4.3.2
providers: 1.8.1
public_key: 1.5.2
relx: 3.32.1
sasl: 3.1.2
snmp: 5.2.11
ssl_verify_fun: 1.1.5
stdlib: 3.4.5.1
syntax_tools: 2.1.4.1
tools: 2.11.2

-----------------
Escript path: /Users/nal/bin/rebar3
Providers:
  app_discovery as clean compile compile cover ct cut deps dialyzer do docs edoc escriptize eunit get-deps help install install_deps key list lock new owner path pkgs publish release relup repo report repos retire revert search shell state tar tree unlock update upgrade upgrade upgrade user version xref
starbelly commented 5 years ago

I believe I know what's causing this problem; I shall have a fix soon.

starbelly commented 5 years ago

@nalundgaard what version of rebar3_hex are you using?

nalundgaard commented 5 years ago

@starbelly I was pinned to the latest when I found this issue, 6.6.0.It seems that it also is broken in the same way from 6.0.0, from what I can see. I reverted to v2.5.0 and that solved my problem for now.