question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

lerna publish should handle retry 403s better

See original GitHub issue

Expected Behavior

retries in lerna publish should gracefully handle 403 for the version that is being published. i.e. if lerna is trying to publish 3.4.5, gets a network hiccup, retries, and that retry fails due to 403, then lerna should only warn, not fail.

Current Behavior

instead, lerna treats 403s as a sign of failure, when, according to my understanding, a 403 on npm publish means that the intended version already exists. if this is a retry, then that’s a warning not a failure.

lerna http fetch PUT 200 http://registry.npmjs.org/@kui-shell%2fplugin-wskflow 11783ms
lerna http fetch PUT 403 http://registry.npmjs.org/@kui-shell%2fplugin-proxy-support 24971ms attempt #2
lerna ERR! E403 You cannot publish over the previously published versions: 3.0.29.

and then we are left with uncommitted changes, because lerna optimistically pushes updates to my repo, but then leaves some of the commit hashes uncommitted, because it gave up. ugh.

Possible Solution

lerna publish could remember that it is doing a retry, and only warn on 403s seen during retries.

Steps to Reproduce (for bugs)

this is an erratic condition, subject to network conditions and the status of npmjs

lerna.json

<!-- Please paste your `lerna.json` here -->

lerna-debug.log

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

Context

Your Environment

Executable Version
lerna --version 3.16.4
npm --version 6.9.0
yarn --version n/a
node --version v10.16.2
OS Version
NAME VERSION
macOS Sierra 10.14.6

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:10
  • Comments:13

github_iconTop GitHub Comments

5reactions
dotansimhacommented, Nov 25, 2019

Same issue here with lerna 3.19.0. Seems like package is published, but it’s marked as failed, then lerna tries to publish it again and fails.

2reactions
ductiletoastercommented, Jan 16, 2020

Doubling down on the suggestion that these types of errors should be notices/warnings. This could even be configurable with a flag. Or even better make retry logic configurable

  • retryTimeout: number
  • retryAttempts: number
  • publishFailuresResultInError: boolean
Read more comments on GitHub >

github_iconTop Results From Across the Web

lerna publish should handle retry 403s better - Bountysource
retries in lerna publish should gracefully handle 403 for the version that is being published. i.e. if lerna is trying to publish 3.4.5, ......
Read more >
Version and Publish - Lerna
Lerna can increment your package's versions as well as publish your packages to NPM, ... If you learn better by doing, clone the...
Read more >
CHANGELOG_ARCHIVE_2017_TO_2018.md ... - GitCode
Python: Handle 403s more intelligently in UpdateChecker ... Dependabot PRs for repos using Lerna will update all of your packages at once (if...
Read more >
5 Best Lerna Alternatives. Tools for JavaScript monorepos and…
Yarn workspaces is a powerful add-on for any other tool you try to build a monorepo experience with. You can even publish directly...
Read more >
Recover from failed lerna publish - cri.dev
The problem I think is related to the fact that the git history is pushed before publishing the packages on npm (that can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found