# Resin Staging Env Env

**URL:** <https://forums.balena.io/t/resin-staging-env-env/451>\
**Category:** Product support\
**Created:** [December 16, 2016, 6:23pm UTC](https://forums.balena.io/t/resin-staging-env-env/451 "2016-12-16T18:23:30Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtwomey](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mtwomey](https://forums.balena.io/u/mtwomey)\
**Post date:** [December 16, 2016, 6:23pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/1 "2016-12-16T18:23:30Z")

</div>

Is there a proper place to discuss items related to staging?

(for example it seems that currently once you add a device level env variable in staging, it “disappears” from the interface. It’s still active, but no longer shows in the interface and thus cannot be removed or changed")

[P.S. if we don’t report staging issues - because, well it’s staging - that’s cool too, just let me know]

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [December 16, 2016, 6:29pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/2 "2016-12-16T18:29:10Z")

</div>

Hey, is that a variable starting with `RESIN_`? If so, it should go to the Fleet Configuration or Device Configuration section. It’s a known “quirk”, that we are working on.

The Environment Variables and Configurations are two similar things, but they have some differences in behaviour that we need to either make less surprising or communicate better.

The Configurations modify the device’s behaviour, some trigger restart (such as the `RESIN_HOST_CONFIG` variables to change Raspberry Pi’s `config.txt`), some doesn’t change anything when added, just later (such as `RESIN_SUPERVISOR_DELTA`, and they affect the device, not the application, hence they are in their own section.

Environment Variables are just that, env vars for your application, and they always trigger restart of the application (but not the device).

This is definitely an area to improve on. ✏

And yeah, can drop in staging stuff right in this category. ✌

---

<div class="post-metadata">

**Author:** ![mtwomey](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mtwomey](https://forums.balena.io/u/mtwomey)\
**Post date:** [December 16, 2016, 8:12pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/3 "2016-12-16T20:12:31Z")

</div>

Hey there - no, it’s not a RESIN\_ variable, it’s just a device specific ENV variable. For example:

(This is the same is Safari, Chrome, and Firefox) Here is the ENV page of one of my devices:

 ![](https://global.discourse-cdn.com/balena/original/1X/e00b10e4e9a764b2c97eed025d86c79235789c77.png)

Yet this is what the environment actually is (from that same device):

 ![](https://global.discourse-cdn.com/balena/original/1X/e0e136ebd2098a8653cb9035f42de5a79c9984c7.png)

I think this is just a JS webpage issue, I can see the REST call the front-end is making to get the ENV variables ([https://api.resinstaging.io/environment?appId=](https://api.resinstaging.io/environment?appId=)…). It respond correctly:

```
{
	"RESIN_HOST_CONFIG_dtoverlay": "pi3-miniuart-bt",
	"droneId_mongo": "584adc6aaebc030004a68a8e",
	"droneId_mongo2": "584adc6aaebc030004a68a8e",
	"RESIN_DEVICE_RESTART": "1981295337117177"
}

```

It just doesn’t show on the page. You’re not seeing this as well in staging?

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [December 16, 2016, 8:48pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/4 "2016-12-16T20:48:47Z")

</div>

Thanks for the detailed feedback, really appreciate it! I’ve just tried, and don’t see it happen myself (on Chrome / Linux).

 ![](https://global.discourse-cdn.com/balena/original/1X/257930250ee39c223540f74c8af74160f9bffd22.png)

What operating system are you on? Do you see any similar issues on production? Since it’s staging, it is indeed not guaranteed to work at any given time, but we are checking whether this is a known issue, or a regression.

@Eugene, do you have any idea what might happen here, or any suggestions how’s the best to debug this?

---

<div class="post-metadata">

**Author:** ![Eugene](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/eugene/32/42_2.png) [@Eugene](https://forums.balena.io/u/Eugene)\
**Post date:** [December 16, 2016, 9:05pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/5 "2016-12-16T21:05:16Z")

</div>

That sounds strange. The most logical explanation would be that it’s actually an app-level var (the /environment endpoint returns the merged vars) and that’s why it’s not visible in the device env vars list.

Can we have a link to the app and device dashboard pages on staging? You share it here or in the Intercom chat session @mtwomey.

---

<div class="post-metadata">

**Author:** ![mtwomey](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mtwomey](https://forums.balena.io/u/mtwomey)\
**Post date:** [December 16, 2016, 10:04pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/6 "2016-12-16T22:04:26Z")

</div>

Yep - I agree, it’s strange indeed. It’s not an app level var though. Here’s the app:

[https://dashboard.resinstaging.io/apps/15984/devices](https://dashboard.resinstaging.io/apps/15984/devices)

Here’s the device:

[https://dashboard.resinstaging.io/apps/15984/devices/52160/summary](https://dashboard.resinstaging.io/apps/15984/devices/52160/summary)

Edit: Just for good measure, I just went to an entirely different computer (PC this time) and I’m seeing the same thing. To extra clarify, this only happens on the staging env.

---

<div class="post-metadata">

**Author:** ![Eugene](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/eugene/32/42_2.png) [@Eugene](https://forums.balena.io/u/Eugene)\
**Post date:** [December 16, 2016, 10:10pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/7 "2016-12-16T22:10:12Z")

</div>

Thanks, we’ll check and get back to you

---

<div class="post-metadata">

**Author:** ![Eugene](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/eugene/32/42_2.png) [@Eugene](https://forums.balena.io/u/Eugene)\
**Post date:** [December 16, 2016, 10:22pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/8 "2016-12-16T22:22:13Z")

</div>

So I’ve checked and the [https://api.resinstaging.io/environment?appId=15984&deviceId=52160](https://api.resinstaging.io/environment?appId=15984&deviceId=52160) request returns an empty object returned by the API, not the thing that you’ve displayed above.  
Which makes me think the UI is probably OK and we need to dig deeper. @imrehg can you please report it and ask someone to look into the API/DB part of this, as well as the device side (to see how actually these variables are being set, and if they are retrieved properly by the supervisor from the API).

Right now my guess is that the changes done some time ago to the env vars management may have permission issues that work well with the device API key but not with the UI’s session token. If that’s the case @Page is the man to talk to.

But it’s just a guess.

@mtwomey we may need to SSH into your device — is it OK?

---

<div class="post-metadata">

**Author:** ![mtwomey](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mtwomey](https://forums.balena.io/u/mtwomey)\
**Post date:** [December 16, 2016, 10:28pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/9 "2016-12-16T22:28:51Z")

</div>

Yes - please go ahead and ssh in.

That’s strange that you got an empty response. I just made a video for you 2 minutes ago (just finished uploading it to Youtube). You can see here - at the end of the video I look at the request directly and can see the response:

---

<div class="post-metadata">

**Author:** ![Eugene](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/eugene/32/42_2.png) [@Eugene](https://forums.balena.io/u/Eugene)\
**Post date:** [December 16, 2016, 10:37pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/10 "2016-12-16T22:37:58Z")

</div>

So we’ve sorted it out, it’s because I was using my account that can see the page but does not have permissions to fetch your env vars. So let me check it again now.

---

<div class="post-metadata">

**Author:** ![Eugene](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/eugene/32/42_2.png) [@Eugene](https://forums.balena.io/u/Eugene)\
**Post date:** [December 16, 2016, 10:40pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/11 "2016-12-16T22:40:05Z")

</div>

Yeah that was my mistake, I can now see this. So scratch my previous comment, it should be the UI issue indeed.

---

<div class="post-metadata">

**Author:** ![mtwomey](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mtwomey](https://forums.balena.io/u/mtwomey)\
**Post date:** [December 16, 2016, 10:41pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/12 "2016-12-16T22:41:42Z")

</div>

Ok cool thanks! One more tiny piece of information I meant to include in the earlier video. When I try to go and add one of the variables that’s already been defined, I get ‘Data is referenced by device\_env\_var\_name.’ which makes sense, since it’s actually already there:

---

<div class="post-metadata">

**Author:** ![Eugene](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/eugene/32/42_2.png) [@Eugene](https://forums.balena.io/u/Eugene)\
**Post date:** [December 16, 2016, 11:01pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/13 "2016-12-16T23:01:20Z")

</div>

Yeah, the latter is expected.  
So I can confirm that this is indeed a purely UI issue, we will fix it soon.  
Thanks again for reporting!

---

<div class="post-metadata">

**Author:** ![mtwomey](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mtwomey](https://forums.balena.io/u/mtwomey)\
**Post date:** [December 16, 2016, 11:01pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/14 "2016-12-16T23:01:52Z")

</div>

Sure thing, thanks for being so responsive!!

---

<div class="post-metadata">

**Author:** ![sqweelygig](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/sqweelygig/32/150_2.png) [@sqweelygig](https://forums.balena.io/u/sqweelygig)\
**Post date:** [December 19, 2016, 5:14pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/15 "2016-12-19T17:14:02Z")

</div>

I caused a bug, my apologies. It should now be resolved on staging, and the originally intended improvements be making their way out to production soon.  
Andrew.

---

<div class="post-metadata">

**Author:** ![mtwomey](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mtwomey](https://forums.balena.io/u/mtwomey)\
**Post date:** [December 19, 2016, 10:43pm UTC](https://forums.balena.io/t/resin-staging-env-env/451/16 "2016-12-19T22:43:12Z")

</div>

Woot! Awesome, thank you! Hey bugs… this is how progress is made, thanks again for your help 🙂
