Search code examples
google-chrome-extension

TypeError: Error in invocation of debugger.detach; No matching signature


I'm working on the chrome.debugger Chrome extensions API, here's the simple example:

chrome.debugger.attach(target, "1.2")
chrome.debugger.sendCommand(target, "Input.insertText", { text: "test."  })
chrome.debugger.detach(target, "1.2")

And in the last line, I get the error:

VM7521:1 Uncaught TypeError: Error in invocation of debugger.detach(debugger.Debuggee target, optional function callback): No matching signature.
    at <anonymous>:1:17

What's the problem here?


Solution

  • I guess I've solved the problem:

    chrome.debugger.detach(target)
    

    Instead of

    chrome.debugger.detach(target, "1.2")
    

    I noticed this while reading the Chrome extension samples on Github:

    chrome-extensions-samples/background.js at e716678b67fd30a5876a552b9665e9f847d6d84b · GoogleChrome/chrome-extensions-samples

    It didn't have the "version" argument in the detach so. Hope this helps.