# Configuration is always empty when using window.Twitch.ext.configuration

**URL:** <https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117>\
**Category:** Extensions\
**Created:** [April 3, 2021, 2:20pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117 "2021-04-03T14:20:03Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![arthurslay](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/arthurslay/32/11590_2.png) [@arthurslay](https://staging-discuss.dev.twitch.com/u/arthurslay)\
**Post date:** [April 3, 2021, 2:20pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/1 "2021-04-03T14:20:03Z")

</div>

Hi,

I have set a configuration panel that allows the broadcaster to set some parameters. These parameters get set OK with window.Twitch.ext.configuration.set().

However, using window.Twitch.ext.configuration to try and retrieve this info always returns an empty object.  
Weird part is, I can get the configuration with postman by using twitch API.

Any idea how I can get the config using Twitch.ext.configuration?

Thanks

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 3, 2021, 2:22pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/2 "2021-04-03T14:22:40Z")

</div>

You do have something like

```javascript

window.Twitch.ext.configuration.onChanged(() => {
    var broadcaster = window.Twitch.ext.configuration.broadcaster;
    if (broadcaster) {
        if (broadcaster.content) {
            var config = {};
            try {
                config = JSON.parse(broadcaster.content);
            } catch (e) {
                console.log(e);
            }

            //do stuff with config
        }
    }
});

```

To read the config you must use `window.Twitch.ext.configuration.onChanged` to trigger config to be loaded

---

<div class="post-metadata">

**Author:** ![arthurslay](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/arthurslay/32/11590_2.png) [@arthurslay](https://staging-discuss.dev.twitch.com/u/arthurslay)\
**Post date:** [April 3, 2021, 3:07pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/3 "2021-04-03T15:07:20Z")

</div>

> [@BarryCarlyon](#):
>
> ```auto
> window.Twitch.ext.configuration.onChanged(() => {
> var broadcaster = window.Twitch.ext.configuration.broadcaster;
> if (broadcaster) {
> if (broadcaster.content) {
> var config = {};
> try {
> config = JSON.parse(broadcaster.content);
> } catch (e) {
> console.log(e);
> }
> 
> //do stuff with config
> }
> }
> });
> 
> ```

That’s how I have it in my code, but config remains ‘undefined’ (exact same result when using your code from above).

Do I have to pass any auth parameters somewhere, maybe?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 3, 2021, 3:10pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/4 "2021-04-03T15:10:17Z")

</div>

> [@arthurslay](#):
>
> Do I have to pass any auth parameters somewhere, maybe?

No

> [@arthurslay](#):
>
> That’s how I have it in my code, but config remains ‘undefined’ (exact same result when using your code from above).

That could suggest you didn’t set the segment you think you did.

Or you might have the config service disabled on this version of the extension (version being an extension version, not a config version) and you wrote to a different version (if you have multiple versions).

So check the extension has the config service enabled in the console.  
Reinstall the extension to the test channel.  
And test it again

If you are testing in the rig, you might have set a different channel for the view than you get setting/getting against using postman. So check that too.

---

<div class="post-metadata">

**Author:** ![arthurslay](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/arthurslay/32/11590_2.png) [@arthurslay](https://staging-discuss.dev.twitch.com/u/arthurslay)\
**Post date:** [April 3, 2021, 3:19pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/5 "2021-04-03T15:19:00Z")

</div>

I have only one version and i’m testing on localhost (no rig).

Here is how the config is set, which I believe sets the segment to “broadcaster”.  
`window.Twitch.ext.configuration.set("broadcaster", '', streamerConfig);`  
with `streamerConfig` being some input from the broadcaster.

Here’s the API call that returns the correct data:  
[https://api.twitch.tv/extensions/[my\_extension\_id]/configurations/segments/broadcaster?channel\_id=[my\_test\_channel\_id]](https://api.twitch.tv/extensions/%5Bmy_extension_id%5D/configurations/segments/broadcaster?channel_id=%5Bmy_test_channel_id%5D). It returns:

```
{
    "broadcaster:[my_test_channel_id]": {
        "segment": {
            "segment_type": "broadcaster",
            "channel_id": "[my_test_channel_id]"
        },
        "record": {
            "content": "test string config"
        }
    }
}
```

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 3, 2021, 3:28pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/6 "2021-04-03T15:28:52Z")

</div>

is `"test string config"` a string or a JSON encoded string?

Not that it should make a difference (I’ve only ever done JSON blobs never a “true” string)

I don’t see anything else obviously wrong.

And I’m assuming your onChanged isn’t “inside” another function? Which could potentially cause an issue. (not tested myself but worth to check, all mine are top level)  
Also check your don’t have more than one call kicking about.

> <https://github.com/BarryCarlyon/twitch_misc/blob/main/extensions/config_service/set_n_publish_frontend.js>

---

<div class="post-metadata">

**Author:** ![arthurslay](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/arthurslay/32/11590_2.png) [@arthurslay](https://staging-discuss.dev.twitch.com/u/arthurslay)\
**Post date:** [April 3, 2021, 3:51pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/7 "2021-04-03T15:51:28Z")

</div>

Yes it’s JSON encoded and onChanged is on top level. I have onContext and onAuthorized at top level, too, but I don’t think this can create a conflict?

Kinda at a loss 🙃 I’m just including an API call in there for now; it’s clunky AF but seems to get the job done.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 3, 2021, 3:53pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/8 "2021-04-03T15:53:04Z")

</div>

Yeah I’m out of the obvious ideas. Since similar calls work for me in a released extension.

Did you we try uninstalling the extension and reinstalling?

And might be worth cracking open dev tools and going digging see if ti throws up anything interesting

---

<div class="post-metadata">

**Author:** ![arthurslay](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/arthurslay/32/11590_2.png) [@arthurslay](https://staging-discuss.dev.twitch.com/u/arthurslay)\
**Post date:** [April 3, 2021, 4:03pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/9 "2021-04-03T16:03:13Z")

</div>

> [@BarryCarlyon](#):
>
> Did you we try uninstalling the extension and reinstalling?

Just tried that but no luck here. I’m developing the extension with React, could this impact it at all?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 3, 2021, 4:03pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/10 "2021-04-03T16:03:59Z")

</div>

> [@arthurslay](#):
>
> I’m developing the extension with React, could this impact it at all?

I don’t know I don’t use react.

But it would seem unlikely since your logged a undefined anyway

May be worth stripping react out and trying a _basic_ HTML/JS example instead to rule it out

---

<div class="post-metadata">

**Author:** ![arthurslay](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/arthurslay/32/11590_2.png) [@arthurslay](https://staging-discuss.dev.twitch.com/u/arthurslay)\
**Post date:** [April 3, 2021, 4:08pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/11 "2021-04-03T16:08:00Z")

</div>

Will try that, thanks Barry!

---

<div class="post-metadata">

**Author:** ![jpaaks](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/jpaaks/32/12053_2.png) [@jpaaks](https://staging-discuss.dev.twitch.com/u/jpaaks)\
**Post date:** [May 4, 2021, 8:07am UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/12 "2021-05-04T08:07:27Z")

</div>

Hi Arthur,

I’m having the same problem, Twitch support is refusing me the extension upload because they see a bug in the configuration option, something that works perfectly in Hosted and Rig.

Initially, I’m asking for the configuration through the API and everything is fine, but Discord has recommended me to get the information through the helper and I’m getting the same as you.

My extension is made in Vue and I am executing the `onChanged` inside the mounted cycle.

whenever I try to obtain a configuration value I get back `undefined`.

Did you manage to solve it?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [May 4, 2021, 11:57am UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/13 "2021-05-04T11:57:17Z")

</div>

> [@jpaaks](#):
>
> whenever I try to obtain a configuration value I get back `undefined`.

This suggests the config service is disabled, or the segment was not set

---

<div class="post-metadata">

**Author:** ![arthurslay](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/arthurslay/32/11590_2.png) [@arthurslay](https://staging-discuss.dev.twitch.com/u/arthurslay)\
**Post date:** [May 5, 2021, 9:11am UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/14 "2021-05-05T09:11:26Z")

</div>

@jpaaks I couldn’t get it solved.

Is the API option a no-go, for getting Twitch’s approval?

---

<div class="post-metadata">

**Author:** ![jpaaks](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/jpaaks/32/12053_2.png) [@jpaaks](https://staging-discuss.dev.twitch.com/u/jpaaks)\
**Post date:** [May 5, 2021, 10:03am UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/15 "2021-05-05T10:03:45Z")

</div>

Just yesterday I received this message from another application rejection where we have been trying to solve the technical problem for 1 month.

> Hey there,
> 
> From what we are seeing, the extension is failing to load the configuration from the Hosted Config Service. Looking through the request being sent to the endpoint, the JWT being generated and sent doesn’t match what we expect for that endpoint. If you could, take a look at our docs to make the fix! [Extensions Reference | Twitch Developers](https://dev.twitch.tv/docs/extensions/reference#get-extension-channel-configuration)
> 
> Twitch Developer Experience Team

The curious thing is that I am using what is commented in the documentation they suggest and the data comes to me as they comment.

The extension works correctly and with it the configuration via API in the Rig, in Local Text and in Hosted Test but they get an error in their test environment.

Yesterday tinkering and messing around on Twitch Dev’s Discord, I was able to get the configuration through the helper in Local and it was by configuring the “Extension Configuration Service” from the panel and refreshing the manifest.

But now I can neither refresh, nor set new values to the config

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [May 5, 2021, 12:48pm UTC](https://staging-discuss.dev.twitch.com/t/configuration-is-always-empty-when-using-window-twitch-ext-configuration/31117/16 "2021-05-05T12:48:14Z")

</div>

> [@arthurslay](#):
>
> @jpaaks I couldn’t get it solved.

Given you never came back to your I thought you had got it working

> [@arthurslay](#):
>
> Is the API option a no-go, for getting Twitch’s approval?

If the extension doesn’t work, becuase your config setting code doesn’t work.  
Then the extension doesn’t work, so it can’t pass review

> [@jpaaks](#):
>
> Yesterday tinkering and messing around on Twitch Dev’s Discord, I was able to get the configuration through the helper in Local and it was by configuring the “Extension Configuration Service” from the panel and refreshing the manifest.

Yeah a _requirement_ for the config service is to have enabled it in the dev console

This is under Capabilities (greyed out as this is a screenshot from a released extension)

 ![image](https://d2spem0quai2ol.cloudfront.net/original/2X/8/855354f4c996bd1328ef2a60e34bdadf713fb959.png)

> [@jpaaks](#):
>
> but they get an error in their test environment.

Review will “use the extension” under “hosted test” but force installed to one of the review channels. (Force as in bypassing any allow list restrictions).

So they are testing it on one of their own channels.

So to test, try installing to a new test channel, or clean back all the config variabels to empty/invalid and (re)install your extension and test the setup.

> [@jpaaks](#):
>
> But now I can neither refresh, nor set new values to the config

The Config service _can be quicky_ in the Developer rig when using the helper to set. Personally I rarely test using the rig since I have a custom rig, behind a reverse SSH tunnel (think NGROK but without restrictions) so my live extension server handles SSL. So I can test to the Twitch Website insteasd of dealing with quirks in the rig.

I wrote a little about it on Part 5 on my Extensions Series [Twitch Extensions Part 5 – Dev Environment – Barry Carlyon](https://barrycarlyon.co.uk/wordpress/2021/03/15/twitch-extensions-part-5/) and my “rig” that handles compilation and serving code is on GitHub [https://github.com/BarryCarlyon/twitch\_extension\_blog\_series/tree/main/part\_5/extension/extension](https://github.com/BarryCarlyon/twitch_extension_blog_series/tree/main/part_5/extension/extension)

So I avoid the rig but serving my extension over SSL and then testing on the Twitch website, I generally avoid the rig since rig doesn’t do “what happens when a user becomes logged out of the extension to logged in” aka State Changes.

But if you are using the Config API to set config then you should avoid the quirks of the dev rig.

But you’ll probably find that if you are using the rig, you have the frontend view and config view set to different broadcasters, great for spot testing, but I wouldn’t use the rig for any actual config setting.

You can also look at adding an `onError` callback to log any errors that get returned

> **[Extensions Reference](https://dev.twitch.tv/docs/extensions/reference/)**
>
> Extensions Reference

Or whip out inspector and trace the calls in the network tab and check its doing what you think it’s doing.

And short of being in fron of your machine to look at what your setup is and how it’s interacting with your code it’s tought to debug this.

Especially since if you gave me your code I predict it would _just work_ on my machine.
