I'm currently trying to automate updates of my web extension in my build pipeline with this API / endpoint https://addons.mozilla.org/api/v3/addons.
So the actual command that I'm using looks like this:
curl "https://addons.mozilla.org/api/v3/addons/" -g -XPOST --form "upload=@dist/firefox/psono.firefox.PW.zip" -F "version=1.0.17" -H "Authorization: JWT ABCDEFG..."
(documentation here http://addons-server.readthedocs.io/en/latest/topics/api/signing.html#uploading-without-an-id )
I'm now where I always get (after a lot of tries and errors with the authentication):
{"error":"Duplicate add-on ID found."}
I have in my manifest this:
"manifest_version": 2,
"name": "psono.PW",
"description": "Psono Password Manager",
"version": "1.0.17",
... alot of other stuff ...
"applications": {
"gecko": {
"id": "{3dce78ca-2a07-4017-9111-998d4f826625}"
}
}
If I remove this "applications" attribute, then it passes, but it creates a new extension instead of updating the existing one. I already diffed the manifest of my existing extension and my new one, and besides some formatting of the JSON and the obvious difference of the version attribute, they look identical.
What am I missing, that the AMO API cannot actually match my update with my existing extension?
While I have not tested it, you are clearly sending the request to the URL which is for WebExtensions without an ID rather than the URL which is for uploading a new version of your add-on with an ID. AMO uses add-on IDs to match the add-on to the currently existing one. The only time a WebExtension does not have an ID is the first time you upload a new extension to AMO (and you have chosen not to assign an ID yourself during development).
After you have uploaded your add-on to AMO for the first time and the WebExtension is listed, it has an ID. Thus, I would assume that the documentation is just not 100% clear that uploading without an ID is only for uploading a new WebExtension add-on. The only thing that makes me think that the URL you are using might be intended for WebExtensions with IDs is the error messages which are claimed to be possible, but that list of errors may just be a copy-&-paste from another section.
Uploading a new WebExtensions add-on (without ID):
curl "https://addons.mozilla.org/api/v3/addons/"
-g -XPOST -F "upload=@build/my-addon.xpi" -F "version=1.0"
-H "Authorization: JWT <jwt-token>"
Uploading a new version of an add-on (with ID):
curl "https://addons.mozilla.org/api/v3/addons/@my-addon/versions/1.0/"
-g -XPUT --form "upload=@build/my-addon.xpi"
-H "Authorization: JWT <jwt-token>"
e.g in your your case:
curl "https://addons.mozilla.org/api/v3/addons/{3dce78ca-2a07-4017-9111-998d4f826625}/versions/1.0.17/"
-g -XPUT --form "upload=@dist/firefox/psono.firefox.PW.zip"
-H "Authorization: JWT ABCDEFG..."
I would consider this to be a problem in the documentation for the upload process where the description of the actual use of the WebExtensions-no-ID URL should be clarified.
Please test this to verify that you can upload a new version (including the applications
in your manifest.json) using the normal URL for uploading a version. If you confirm that works, I'll submit a pull request to the documentation to make it more clear.
Note: The documentation on MDN, when talking about updating your add-on, states:
It's essential with this workflow that you update the add-on manually using its page on AMO, otherwise AMO will not understand that the submission is an update to an existing add-on, and will treat the update as a brand-new add-on.
However, it should be noted that even that section is talking about updating an add-on without an ID specified in the applications
key. Thus, even that documentation is not 100% clear.
If the URL you are using is actually intended for both new WebExtensions without an ID and new versions of already existing WebExtensions with an ID:
"Duplicate add-on ID found."
error rather than having the error text explain that a duplicate version exists for this ID. If this is the case, then I would consider there to also be clarification needed in the documentation that URL is for both WebExtensions with and without an ID: that stating it's without an ID is only with respect to the URL used and parameters passed to the API.