I saved a variable in key: data Console.log(data.key), gives me out my data.
But now I send a message to the background.js from my popup.js and it doesnt read line:
sendResponse(data.key);
result = undefined, I tried to move it out of chrome.storage.local.get("key", function(data) { }) and it worked with a test variable.
Popup.js:
chrome.runtime.sendMessage({from: 'popup',subject: 'ubisoft'}, function (result) {
        window.alert(result)
        
      });
Background.js:
  chrome.runtime.onMessage.addListener((msg, sender,sendResponse) => {
    // First, validate the message's structure.
    if ((msg.from === 'popup') && (msg.subject === 'ubisoft')) {
      // Enable the page-action for the requesting tab.
      chrome.storage.local.get("key", function(data) {
        // Do something with data.key
        console.log(data.key)
        sendResponse(data.key);
      });
    }
  });
