Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

304
Visualizações
How to solve 'No Matching Signature' error in chrome messaging API?

I'm making a simple chrome extension and I ran into this error. I've tried looking around to and the most I've found is that I'm likely running into an error with the parameters of the chrome.tabs.sendMessage. I tried console.log(tab[0].id) and it is in fact an integer. The docs say the message param can be a string and the other two params are optional and not needed in this context.

Uncaught (in promise) TypeError: Error in invocation of tabs.sendMessage(integer tabId, any 
message, optional object options, optional function callback): No matching signature.
at background.js:18:21

Here's my code:

chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
    "title": 'Help With PIM',
    "id": 'pimhelper',
    "contexts": ['all'],
});

});

chrome.contextMenus.onClicked.addListener(async (info) => { if (info.menuItemId === "pimhelper") {

    let queryOptions = { active: true, currentWindow: true };
    let tab = await chrome.tabs.query(queryOptions);

    chrome.tabs.sendMessage((tab[0].id, '"message"'))
}

});

Possible ideas:

There might be something wrong with the message param and I read something about data serialization on the docs. Not sure how to use the JSON parse or stringify methods to solve this however.

I apologize if this is some noob mistake. I am entirely new to creating chrome extensions.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda