Repository navigation
fix(sign): Defaulted amoBaseUrl when signing from the Node API - #3833
Merged
Merged
Conversation
Rob--W
approved these changes
Sep 24, 2026
Rob--W
left a comment
Member
There was a problem hiding this comment.
Looks good; we should wait with merging this until right before we publish a new version, because otherwise people trying out the code from README.md will find it not working.
The documented default for amoBaseUrl only existed as a yargs default in the CLI option table, so it was applied on the command line and nowhere else. Calling webExt.cmd.sign() from Node without that option passed undefined down to signAddon(), which rejected it with "Invalid AMO API base URL: undefined". The constant now lives in src/util/constants.js, program.js imports and re-exports it so existing imports keep working, and src/cmd/sign.js uses it as the parameter default. The README example for webExt.cmd.sign() no longer passes amoBaseUrl, because it is no longer needed there. Fixes mozilla#3164
Rob--W
force-pushed
the
fix/amo-base-url
branch
from
October 8, 2026 12:38
cd1f6c2 to
b309b2f
Compare
Merged
willdurand
added a commit
that referenced
this pull request
Oct 15, 2026
## main changes - Added: in **web-ext lint**, add support for the Firefox 158 schema data. See: https://github.com/mozilla/addons-linter/releases/tag/10.14.0 - Fixed: silent reload failures on Chrome 125 and earlier (#3836) - Fixed: files not being ignored when `sourceDir` contains glob characters (#3835) - Fixed: in **web-ext sign**, fixed default `amoBaseUrl` value when signing from the Node API (#3833) ## dependencies - Updated: dependency `pino` to 10.4.0 (#3896) - Updated: dependency `yargs` to 17.7.3 (#3885) - Updated: dependency `open` to 11.0.4 (#3858) ## dev dependencies - Updated: dependency `@eslint/js` to 9.39.5 (#3886) - Updated: dependency `brace-expansion` to 1.1.21 (#3880) - Updated: dependency `chai` to 6.3.0 (#3892) - Updated: dependency `fast-uri` to 3.1.8 (#3881) - Updated: dependency `fs-extra` to 11.4.1 (#3876) - Updated: dependency `globals` to 17.13.0 (#3890) - Updated: dependency `mocha` to 12.0.3 (#3891) - Updated: dependency `mozilla/addons/.github/actions/release` to 1.3 (#3878) - Updated: dependency `prettier` to 3.9.9 (#3877) - Updated: dependency `serialize-javascript` to 7.1.2 (#3882) - Updated: dependency `source-map-js` to 1.2.2 (#3894) - Updated: dependency `testdouble` to 3.23.0 (#3901) - Updated: dependency `undici` to 7.30.0 (#3874)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3164.
Calling
webExt.cmd.sign({apiKey, apiSecret, artifactsDir, channel, sourceDir})from Node fails withInvalid AMO API base URL: undefined. The default only exists as a yargs default in the CLI option table (src/program.js:527), so it is applied on the command line and nowhere else. src/cmd/sign.js:23 destructuresamoBaseUrlwith no default, andsignAddonrejects a missing value at src/util/submit-addon.js:500-503. The reporter hit this moving from 7.x to 8.x and worked around it by hardcodingamoBaseUrl: 'https://addons.mozilla.org/api/v5/', which pins them to an API version web-ext is meant to manage for them.This moves the constant into a new dependency-free module, src/util/constants.js. src/program.js imports it and re-exports it, so
import { AMO_BASE_URL } from './program.js'keeps working for existing callers and tests, and the CLI option table is untouched. src/cmd/sign.js imports it from the new module rather than from src/program.js, so a Node API caller does not pull yargs and the rest of the CLI in behind it. No command module imports src/program.js today, and src/cmd/index.js loads commands lazily for the same start-up reason (#1302).One scope note:
signAddon()in src/util/submit-addon.js still takesamoBaseUrlexplicitly. It is public API, since package.json exports./util/submit-addon, so this is a real choice rather than an oversight. I kept the change to the entry point the issue reports, but signAddon() can get the same default here if you would rather have it in one place.The new test is "defaults the AMO base URL when it is not passed in" in tests/unit/test-cmd/test.sign.js.
getStubs()always suppliesamoBaseUrl, so the test copies the stub config, deletes that key, and asserts thatsubmitAddonwas called with the default. Reverting the one line in src/cmd/sign.js makes it fail withamoBaseUrl: undefined. The README example forwebExt.cmd.sign()also drops the hardcodedamoBaseUrl; thesignAddon()example below it keeps it, because that entry point still needs it.Unit tests, eslint and prettier pass locally.