hexpm / hex

Package manager for the Erlang ecosystem.
https://hex.pm
973 stars 185 forks source link

Publishing to private repository gives Internal Server Error #576

Closed kelostrada closed 6 years ago

kelostrada commented 6 years ago

I'm trying to publish a package on private repository.

Publishing package to private repository xxx.
Proceed? [Yn] 
Building docs...
Compiling 2 files (.ex)
Docs successfully generated.
View them at "doc/index.html".
Local password: 
Publishing package...
[#########################] 100%
Publishing failed
Internal server error

I found out that the problem is with dependencies tree.

Let me give you an example:

There is a package ueberauth, ueberauth_identity and ueberauth_google.

I had to fork ueberauth and ueberauth_google because I needed to change something and published them to private repository, so my mix.exs deps look like this:

{:ueberauth, "~> 0.5.0", organization: "xxx"},
{:ueberauth_identity, "~> 0.2.3"},
{:ueberauth_google, "~> 0.6.0", organization: "xxx"},

My changed ueberauth_google also uses ueberauth from organization. There comes the conflict, because mix probably doesn't understand how to resolve ueberauth because ueberauth_identity wants to use ueberauth from public hexpm repository.

Obviously there is no real way of resolving this correctly, as packages in hexpm cannot use override: true in deps definitions. However the error which you receive when publishing is not a clear one, hence the Issue.

Regards

ericmj commented 6 years ago

Are you trying to publish a private package that depends on the three ueberauth packages?

Can you try publishing again because I am not seeing any errors in the logs that could be related to this.

It looks like you unfortunately need to fork ueberauth_identity as well so it can use your other forks.

kelostrada commented 6 years ago

I can prepare exact scenario that produces this error later and you will be able to push yourself like this. Just give me a day, because probably today I won't have time for this.

I already made a fork of ueberauth_identity and it worked ;) Buy you can look into the error itself. Thanks

kelostrada commented 6 years ago

I created a simple repository which should give you an idea how to reproduce the bug (Internal Server Error). I guess it's not fatal, but probably you should have a better error than that for your commercial customers ;)

https://github.com/kelostrada/private

I took a plug repository and created my own fork (didn't really change anything) and published it into private hex repo. Then in my private_project I used phoenix as a dependency and plug from my organization. It's a simpler case than the one I mentioned before, but with the same problem. Let me know if you need anything else!

ericmj commented 6 years ago

The error is now:

Validation error(s)
  requirements:
    phoenix:
      Failed to use "plug" because
        mix.exs requires repo eric
        phoenix requires repo hexpm

    plug:
      Failed to use "plug" because
        mix.exs requires repo eric
        phoenix requires repo hexpm