erlef / rebar3_hex

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

Bad Request when publishing an erlang package #44

Closed hukl closed 4 years ago

hukl commented 8 years ago

I've tried to publish an erlang package. I followed the guide on hex.pm, I installed rebar3 and rebar3_hex for the first time. I registered and account. I've added all the metadata, I accepted the code of conduct and then it fails saying:

===> Status Code: HTTP status code: 400 Hex Error: Bad request

What is even worse: The package is listed on the frontpage now but if I click on it I get a 404. I can also not unpublish it - this whole process should be transactional.

So how can I debug this? The package source is here:

https://github.com/hukl/rstats

tsloughter commented 8 years ago

The client does a single post to add the package. So any transactional issue would be on the hex_web side.

This is a tough issue to debug since we don't know what data hex is failing on.

I'll have to talk to Eric to find out how we can know what is actually blowing up.

tsloughter commented 8 years ago

What Erlang and rebar3 version are you using?

ericmj commented 8 years ago

I tested publishing rstats with rebar3 to a local version of the hex server and it worked without errors.

hukl commented 8 years ago

Erlang 18.3. I Installed the latest rebar3 release and I also cloned and bootstrapped manually

hukl commented 8 years ago

Because of the certificate pinning I could not use a proxy in between :/ Are there any more options for debugging what is wrong? Like manually compiling rebar3_hex and insert more debug code at the right spots?

hukl commented 8 years ago

I already looked in the rebar3_hex code and inserted some debug messages before the post is happening but I don't know how to manually "install" the plugin

hukl commented 8 years ago

Also I just tried to publish again and the 400 Bad Request is still there and now the package is again half published: https://hex.pm/packages?_utf8=✓&search=rstats&sort=downloads

Output from publish command:

DEBUG=1 rebar3 hex publish                                             
===> Load global config file /Users/hukl/.config/rebar3/rebar.config
===> Expanded command sequence to be run: []
===> Expanded command sequence to be run: [{default,app_discovery},
                                                  {default,install_deps},
                                                  {default,lock},
                                                  {hex,publish}]
===> Verifying dependencies...
Publishing rstats c5c5888
  Dependencies:

  Excluded dependencies (not part of the Hex package):

  Included files:
    /Users/hukl/Projekte/rstats/src/rstats.app.src
    /Users/hukl/Projekte/rstats/src/rstats.erl
    /Users/hukl/Projekte/rstats/rebar.config
    /Users/hukl/Projekte/rstats/rebar.lock
    /Users/hukl/Projekte/rstats/README.md
Before publishing, please read Hex CoC: https://hex.pm/docs/codeofconduct
Proceed? ("Y")> Y
===> Status Code: HTTP status code: 400
Hex Error: Bad request
ericmj commented 8 years ago

@hukl Have you done any changes to rstats that you did not publish to the github repo?

tsloughter commented 8 years ago

@hukl if you link to your modified version of rebar3_hex in a directory _checkouts/ at the root of rstat it will use that copy of the plugin.

tsloughter commented 8 years ago

Oooooo: Publishing rstats c5c5888

hukl commented 8 years ago

@tsloughter what does the Oooooo mean? :)

hukl commented 8 years ago

@ericmj latest commit on github is the latest commit I have locally:

commit e9644fe2a982c93c7cf6769829956804ed543393 Date: Wed Apr 27 16:11:55 2016 +0200

Corrected maintainers
tsloughter commented 8 years ago

Hehe, sorry. That version isn't parse-able by hex. We don't currently verify that on the client side before sending. We could do that, but will be good if hex could also send back a response with an error message.

hukl commented 8 years ago

@tsloughter but in the app.src file I've set it to "1.0.0"

tsloughter commented 8 years ago

Do you have a ./ebin dir at the top level maybe? rebar3 would pick that up if you did and it had a .app in it. otherwise it should be using the 1.0.0 from the app.src. Hmm...

hukl commented 8 years ago

Ah right - so before I've build it with rebar 2 with a top level ebin - there was still the old version. Lets try again with that cleaned up

hukl commented 8 years ago

Yay - that worked! https://hex.pm/packages/rstats

Thank you for the support!

tsloughter commented 8 years ago

Cool.

That is sadly a common issue in various parts of rebar3 for people :(. But we have to support projects that keep a custom .app in a top level ebin/ especially now that this is the default way erlang.mk works, generating the ebin/*.app from the Makefile configuration :(.

ericmj commented 8 years ago

Maybe rebar should warn if you have both? Or have app.src take priority?

crownedgrouse commented 6 years ago

Hi got also a HTTP 400 by setting a version 1.1 and not 1.1.0 . A fatal error should be raised instead cryptic HTTP 400 while trying to publish

starbelly commented 4 years ago

I believe this issue has has been resolved. Please re-open if otherwise.