gleam-lang / hexpm-rust

⚗️ A Rust client for the Hex package manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Authorization issue when trying to publish

sporto opened this issue · comments

As discussed in Discourse. I'm able to publish the library to Hex e.g. https://hex.pm/packages/gleam_validator

But when I do:

gleam docs publish --version 0.2.0

I get

error: Hex API failure

There was a problem when using the Hex API.

This was error from the Hex client library:

    this account is not authorized for this action

Relevant code https://github.com/gleam-lang/hexpm-rust/blob/main/src/lib.rs#L477

Thanks

I found the issue looking at the rust code.
The api will give the 403 error if you try to publish a package that doesn't belong to you.

I was able to publish to hex because I had:

{application, gleam_validator, ...

In gleam_validator.app.src

But in gleam.toml I had just validator.
After changing this to gleam_validator too, the publishing worked.

This can be confusing. Maybe something could check that these names are the same.

Ah that explains it! I'm glad you found the cause of the problem.

The .app.src / gleam.toml split is confusing for sure. I'm hoping to remove the .app.src and have it generated (like mix does) so this won't be a problem then.

Maybe we could include the name of the package in the error- that could help.