javascript – Send message from content script to background

I have to send message from content script to background, a i always got error Uncaught TypeError: Cannot read property 'sendMessage' of undefined

background script is unnecessary, because i have error in the content script

I used chrome.extension.sendMessage

content script:

  try {
    chrome.storage.sync.set({
      "channelId": cid
    });
  } catch (error) {
    if (toReload(error.toString())) {

      chrome.runtime.sendMessage({ message: "errorreset" }, function (response) {
          console.log(123);
        });
        
    }
  }

And when i could try send to tab, i got error Uncaught TypeError: Cannot read property 'query' of undefined

    chrome.tabs.query({
        active: true,
        currentWindow: true
    }, function (tabs) {
        chrome.tabs.sendMessage(tabs(0).id, {
            "message": text
        });
    });