Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing HTTP_NPM_SCOPE header when publishing #1968

Closed
m2bright opened this issue Mar 8, 2019 · 6 comments · Fixed by #1985
Closed

Missing HTTP_NPM_SCOPE header when publishing #1968

m2bright opened this issue Mar 8, 2019 · 6 comments · Fixed by #1985

Comments

@m2bright
Copy link

m2bright commented Mar 8, 2019

We are attempting to do a lerna publish to packagecloud.io. The packagecloud.io API is failing with a 422 indicating that the NPM_SCOPE parameter is not set properly. After speaking with one of their engineers, they are expecting that the HTTP_NPM_SCOPE parameter be set properly, and in fact it is not being passed.

Expected Behavior

We are expecting that lerna publish will publish to packagecloud.io.

Current Behavior

We are told that the HTTP_NPM_SCOPE parameter is not being set by lerna, when the publish is being called.

Possible Solution

Can we add that as part of the publish?

Steps to Reproduce (for bugs)

  1. Have a packagecloud account.
  2. nvm install (lts/dubnium) (this is node 10.15.3 and npm 6.4.1)
  3. run npm publish ( It will publish)
  4. run lerna publish (it will fail with a 422 indicating that the npm-scope variable is missing.)
lerna.json

<!-- Please paste your `lerna.json` here -->
{
  "packages": [
    "dev/*"
  ],
  "npmClient": "npm",
  "command": {
    "publish": {
      "yes": true,
      "ignoreChanges": [
        "*.md",
        "*.spec.js"
      ]
    }
  },
  "useWorkspaces": true,
  "version": "independent"
}

lerna-debug.log

<!-- If you have a `lerna-debug.log` available, please paste it here -->
<!-- Otherwise, feel free to delete this <details> block -->

Context

We want to use lerna to publish and maintain a monorepo. We can't publish. Everything else works great, lerna version, lerna bootstrap, lerna list - but the publish doesn't work.

Your Environment

Executable Version
lerna --version 3.13.1
npm --version 6.4.1
yarn --version 1.12.3
node --version 10.15.3
OS Version
ubuntu 14.04
@evocateur
Copy link
Member

I have no idea what HTTP_NPM_SCOPE is. A header? An env var? Lerna uses the same publish mechanism as npm itself (since v6.6.0), does npm publish work with recent versions?

@m2bright
Copy link
Author

m2bright commented Mar 9, 2019 via email

@evocateur evocateur changed the title Missing HTTP_NPM_SCOPE parameter when publishing Missing HTTP_NPM_SCOPE header when publishing Mar 9, 2019
@evocateur
Copy link
Member

A lerna_debug.log from a failed publish would be appreciated.

@m2bright
Copy link
Author

m2bright commented Mar 9, 2019 via email

@armandocanals
Copy link
Contributor

Hi! Armando from packagecloud checking in.

After digging into this issue, it looks like what's happening is that Lerna is passing the full @scope/package-name instead of just @scope to libnpmpublish which sets it as the HTTP_NPM_SCOPE header.

projectScope: pkg.name,

The official registry supports both @scope and @scope/packagename for HTTP_NPM_SCOPE, but packagecloud does not.

From what I understand, this header is supposed to include just the @scope for a package.

I'm inclined to say that Lerna should only pass the @scope to libnpmpublish instead of the entire @scope/packagename, but I'm not familiar with the needs of the project, so I could be wrong.

We're also discussing how to handle this better at packagecloud.

@evocateur
Copy link
Member

The docs for project-scope are kinda vague on exactly what they should be used for. I'm cool with passing spec.scope (from npm-package-arg) there, instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants