Config.js twitch.configuration.broadcaster undefined

hi i developed an extension and i need to develop with the twitch ebs service
for more cofortable extension for streamer
my console configuration

I have browsed the forums but I do not understand why it does not work

my config.js code :

let token, userId;

const twitch = window.Twitch.ext;

twitch.onContext((context) => {
  twitch.rig.log(context);
});

twitch.onAuthorized((auth) => {
  token = auth.token;
  userId = auth.userId;


});


twitch.configuration.onChanged(function() {
  // Checks if configuration is defined
console.log("onchanged")
console.log(twitch.configuration)
  if (twitch.configuration.broadcaster) {
    try {
      // Parsing the array saved in broadcaster content
      var config = JSON.parse(twitch.configuration.broadcaster.content);
      
      // Checking the content is an object
      if (typeof config === 'object') {
        // Updating the value of the options array to be the content from config
        options = config;
        updateOptions();
      } else {
        console.log('Invalid config');
      }
    } catch (e) {
      console.log('Invalid config');
    }
  }
});
  

function updateConfig() {
 var array1 = new Array();
array1.push("test")
array1.push("test1")
array1.push("test3")
array1.push("test4")
console.log("appelupdate");
twitch.configuration.set('broadcaster', '1', JSON.stringify(array1));
console.log(twitch.configuration);

}

updateConfig() 

why my twitch.configuration.broadcaster in config section extension is all time undefined i dont understand
my extension is in test hosts
thx for response

That would suggest that

twitch.configuration.set('broadcaster', '1', JSON.stringify(array1));

failed for some reason.

is the user, using the view that is trying to .set the broadcaster?

You can also bind an error handler to help debug/trace the issue

You can also check what is in the config service via

Also worth noting that the config is not populated/changed after a set on the same page until you reload the page. (Or your write code to do that, and onChanged is only called once during page load and never again)

So when I’m config setting via the API I push the same config out over pubsub to update running instances

the user is me on my account chanel in a configuration extension

with this code added

window.Twitch.ext.onError(function(t) {

console.log(t)
}
)

i have this error

Error: Twitch.ext.configuration.set attempted before onAuthorized returned
at Object.setConfiguration (twitch-ext.min.js:30:82223)
at updateConfig (config.js:49:22)
at config.js:63:1

ok i call updateConfig() in twitch.onAuthorized

twitch.onAuthorized((auth) => {
token = auth.token;
userId = auth.userId;
updateConfig()
});

and i have a object is fine

You ran your .set too soon

You need to wait for onAuthorised before you can set.

This normally is not an issue if you do a .set in response to a streamer doing an action such as hitting a submit button.

So, move the updateConfig() from the end of the JS to inside the onAuthorized as a minumum.

twitch.onAuthorized((auth) => {
  token = auth.token;
  userId = auth.userId;

  updateConfig() 
});