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

--use-submission-api results in HTML response with "Oops! We can’t find that page" #2579

Closed
karlicoss opened this issue Dec 24, 2022 · 6 comments · Fixed by #2621
Closed

Comments

@karlicoss
Copy link

Is this a feature request or a bug?

Bug.

What is the current behavior?

So far I've been successfully using sign and publishing my addon without --use-submission-api.
I've decided to give this flag a go:

'npm', 'run', 'web-ext', '--', 'sign', 
'--use-submission-api', 
'--channel', 'unlisted',
'--source-dir', '.../code/grasp/extension/dist/firefox', 
'--artifacts-dir', '.../grasp/extension/dist/artifacts/firefox', 
'--api-key', 'KEY', '--api-secret', 'SECRET'

My extension's manifest version is 2 (not sure whether this matters). I also had to add extension ID to the manifest, otherwise web-ext complained.

  "browser_specific_settings": {
    "gecko": {
      "id": "{37e42980-a7c9-473c-96d5-13f18e0efc74}"
    }
  },

However this resulted in a cryptic error. I nailed it down to this line
https://github.com/mozilla/web-ext/blob/master/src/util/submit-addon.js#L246
Somehow instead of JSON, I got a html page with the following content

Oops! We can’t find that page

If you’ve followed a link from another site for an extension or theme, that item is no longer available. This could be because:

    The developer removed it. Developers commonly do this because they no longer support the extension or theme, or have replaced it.
    Mozilla removed it. This can happen when issues are found during the review of the extension or theme, or the extension or theme has been abusing the terms and conditions for addons.mozilla.org. The developer has the opportunity to resolve the issues and make the add-on available again.

I added a bit more debug logging to web-ext and this is the fetch call that fails:

URL URL {
  href: 'https://addons.mozilla.org/api/addons/upload/',
  origin: 'https://addons.mozilla.org',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'addons.mozilla.org',
  hostname: 'addons.mozilla.org',
  port: '',
  pathname: '/api/addons/upload/',
  search: '',
  searchParams: URLSearchParams {},
  hash: '',
  cannotBeBase: false,
  special: true,
  [Symbol(context)]: URLContext {
    flags: 400,
    scheme: 'https:',
    username: '',
    password: '',
    host: 'addons.mozilla.org',
    port: null,
    path: [ 'api', 'addons', 'upload', '', [length]: 4 ],
    query: null,
    fragment: null
  }
}
METHOD 'POST'
BODY [
  [ 'channel', 'unlisted', [length]: 2 ],
  [
    'upload',
    File {
      [name]: [Getter],
      [lastModified]: [Getter],
      [Symbol(Symbol.toStringTag)]: [Getter],
      size: [Getter],
      type: [Getter]
    },
    [length]: 2
  ],
  [length]: 2
]
HEADERS {
  Authorization: 'JWT <REMOVED>',
  Accept: 'application/json'
}

Anything I'm doing wrong?

What is the expected or desired behavior?

Extension is uploaded to addons.mozilla.org

Version information

$ node --version && npm --version && npm run web-ext -- --version
v18.12.1
8.19.2
7.4.0
@willdurand
Copy link
Member

cc @eviljeff

@eviljeff
Copy link
Member

eviljeff commented Jan 3, 2023

pathname: '/api/addons/upload/',

this pathname is wrong - should be /api/v5/addons/upload/ I think - but I can't immediately see how it would end up with the wrong value.

@eviljeff
Copy link
Member

eviljeff commented Jan 3, 2023

my best guess is the v5 is being stripped from the amo-base-url default value of 'https://addons.mozilla.org/api/v5'. Maybe that's happening by default (😞)

@karlicoss can you confirm by adding --amo-base-url=https://addons.mozilla.org/api/v5/ to your command (i.e. the default value, but with a trailing /)

@Rob--W
Copy link
Member

Rob--W commented Jan 5, 2023

The URL is constructed at

this.apiUrl = new URL('addons/', baseUrl);
. This causes the last part of the URL to be dropped. Minimal test case: new URL('addons/', 'http://a/b/v5').href -> http://a/b/addons/ without /v5. We should ensure that / is appended to the path if it is missing.

We have a unit test checking the base URL at

assert.deepEqual(clientSpy.firstCall.args[0], {
, but don't check the final URL anywhere else...

@karlicoss
Copy link
Author

@eviljeff can confirm adding the base URL worked -- successfully uploaded a new version to the unlisted channel, and web-ext waited for the approval

@ioanarusiczki
Copy link

@eviljeff

I could submit without errors listed and unlisted versions using --amo-base-url=https://addons-dev.allizom.org/api/v5

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

Successfully merging a pull request may close this issue.

5 participants