Firefox extension update problem- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

The company I work for has a Firefox extension that we privately distribute so it isn’t in the AMO store. We are able to automatically update our extension using a JSON update manifest. The xpi package includes an update.rdf which has a link to the updated xpi file.

I have been through the process of updating our Firefox extension once before without issue. This time, however, when I try to update the extension through the Add-ons Manager, it responds with the message “No updates found.” This is what is logged in the browser console:

1561581031192	addons.update-checker	WARN	onUpdateCheckComplete failed to parse update manifest: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data(resource://gre/modules/addons/AddonUpdateChecker.jsm:288:23) JS Stack trace: onLoad@AddonUpdateChecker.jsm:288:23
UpdateParser/<@AddonUpdateChecker.jsm:239:54

1561581031340	addons.update-checker	WARN	onUpdateCheckComplete failed to parse update manifest: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data(resource://gre/modules/addons/AddonUpdateChecker.jsm:288:23) JS Stack trace: onLoad@AddonUpdateChecker.jsm:288:23
UpdateParser/<@AddonUpdateChecker.jsm:239:54

Here is a link to my manifest.json file

The only change I made to the JSON file that worked previously was to update the version number so I don’t understand why it wouldn’t work this time. It checks out okay on JSONlint. I have gone through the process three times but no joy.

I have researched the “JSON.parse: unexpected character” error but didn’t find anything pertinent to my situation. Any insights into this issue would be greatly appreciated. Thank you!

1 Like

Support for the update.rdf file has been deprecated in Firefox 67, the “JSON update manifests” file format should now be used instead: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Updates

Our developer has created an update.json file but he isn’t sure where the json file is to be specified if not in the manifest. Can anyone point me in the right direction?

The update_url property in the manifest should point to the update.json file on your web server.

We had the update_url property in the manifest but when I tried to upload the file to the store I received this error.

That error is accurate. If you want to use your own update.json you have to self-host the XPI and can not have the extension available on addons.mozilla.org. If you want your extension to be hosted and updated by addons.mozilla.org then you don’t need either.

So the update.json file should go in the .xpi file that is signed by AMO?

No. If you have your extension available on addons.mozilla.org in a public listing, so there’s a webpage on there with your extension, then you don’t need to worry about the update.json or update_url yourself.

If you, however, chose to not have it listed on addons.mozilla.org (or can not due to policies) then you will have to include the update_url pointing to the update.json in your xpi that you sign. However the update.json does not have to be signed and instead is hosted on some webserver.

Since you say it’s privately distributed I think the confusion comes from trying to upload it as publicly listed XPI, where you can not have an update_url.

Thank you, this has been useful to point me in the right direction. I’ve gotten my signed xpi file and uploaded it to our AWS account. However, when I check for updates, my extension doesn’t get updated. Here is a link to my update.json file, and to my manifest.json file. I’m not sure if it is something in the code or something else. Could someone check to see if there is anything obvious in these files that may be causing the problem? Thank!

My first hunch would be the incorrect Content-Type header for the update.json.

I changed the Content-Type header to “application/json” but that didn’t work. Should it be a different content-type?