0

I built a small Chrome extension that works properly using the Chrome extension Manifest v2; however, support for v2 has been deprecated and updates must be published using Manifest v3.

Seems straightforward enough but Chrome throws an error when trying to load the unpacked extension with the new Manifest. Moreover, the error that it throws seems unrelated to the code I wrote and refers to one of the common libraries that I imported. The libraries I import include debounce for lodash, get from lodash, cheerio, and axios.

Here are both versions of the manifest followed by the error that Chrome throws when loading the extension via the new manifest.

Any pointers would be greatly appreciated. Thank you so much!

Manifest v2

{
  "name": "LastBottle Price Checker",
  "version": "1.0.0",
  "description": "Fact-check the retail and web prices advertised on LastBottleWines.com by viewing crowd-sourced from consumers.",
  "manifest_version": 2,
  "icons": {
    "128": "icon128.png"
  },
  "permissions": ["*://www.vivino.com/*", "*://api.vivino.com/", "unlimitedStorage", "activeTab"],
  "content_scripts": [
    {
      "matches": ["https://www.lastbottlewines.com/*"],
      "js": ["contentScript.js"]
    }
  ],
  "background": {
    "scripts": ["bgScript.js"],
    "persistent": false
  }
}

Manifest v3

{
  "name": "LastBottle Assistant",
  "version": "1.0.0",
  "description": "Fact-check the retail and web prices advertised on LastBottleWines.com by viewing crowd-sourced from consumers.",
  "manifest_version": 3,
  "icons": {
    "128": "icon128.png"
  },
  "permissions": ["unlimitedStorage", "activeTab"],
  "host_permissions": ["*://www.vivino.com/*","*://api.vivino.com/"],
  "content_scripts": [
    {
      "matches": ["https://www.lastbottlewines.com/*"],
      "js": ["contentScript.js"]
    }
  ],
  "minimum_chrome_version": "93",
  "background": {
    "service_worker": "bgScript.js",
    "type": "module"
  }
}

Error thrown by Chrome when loading unpacked extension

The first message is seemingly caused by the second...

Screenshot 1 of 2

Screenshot 2 of 2

I tried following Google's guide for migrating to Manifest v2, including the move from the background scripts to the service_worker framework. The service_worker conforms to the single JS file requirement and unchanged from the single JS file that worked properly when run in the previous manifest. The service_worker also meets the stated requirement of not interacting with the DOM.

burnsi
  • 6,194
  • 13
  • 17
  • 27
Botlanta
  • 1
  • 1
  • [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) – Norio Yamamoto Jan 17 '23 at 04:06
  • Code 15 means an error while running script. Evidently these packages are incompatible with a service worker. Depending on the exact cause there may be a workaround. First, use an empty background script and reload the extension, then open [devtools for it](/a/10258029), then paste parts of the full code e.g. the line 1 on your screenshot, then lines 2-5, 7-... until it shows an error. – wOxxOm Jan 17 '23 at 08:42
  • Thank you @wOxxOm. Super appreciate your insight. – Botlanta Jan 17 '23 at 19:50

0 Answers0