Switching between environments

  • Goal: Change between production and staging environments

  • Steps: From the current environment of staging, click to change to the Production environment

  • Details: When clicking to change to the Production environment, the page redirects back to the Staging environment

By clearing local storage and cookies, this problem is temporarily resolved but it's super annoying.

1 Like

Hello @Michael_Stone,

Very odd behavior, the environment should not change or trigger any kind of redirect between environments. It should only change on user click.

I am glad you were able to find a work around but want to investigate further. Can you share a video of the behavior where the app switches from production back to staging?

I am sure you know but in Retool the environment will not let you change if you have a resource that has not been configured to the environment you want to switch into.

If you can give me any steps to reproduce this issue I can send that to our engineering team via a bug report to have them take a look and hopefully fix this!

Hey Jack, thats for getting back to me! Can I dm you a link to a loom video of this happening?

We've definitely got config set up for the production environment, and I can't see anything wrong with it but it's definitely possible.

Another side effect is related to setting _environment=staging as a url param? Once that's in the URL, even if I remove the param and reload, it gets added back on.

Yes definitely DM me a loom video! very curious to see your perspective on this bug.

Not super familiar with how the URL params behave. I believe that as long as the app thinks you are suppose to be in staging it will continue to default to that.

To switch environments the biggest issue is to be sure that any and all resources in the app have both/all environments enabled for them as I had in the screenshot I shared.

That should be the only limiting factor on changing environments but if you have that set up correctly, the bug might be coming from elsewhere :thinking:

I'm am fairly sure we do have the envs set up correctly because once I clear my cookies and local storage it starts behaving again.

Ok that is great to hear.

I am trying to think of what data would be in cookies/local storage that would lead the app to think that you should stay in the Staging environment :thinking:

If the Resources were not set up properly, then the other env options would be greyed out and not clickable.

But as you mentioned before, you are able to click into the env and see the change even if briefly before the page switches you back, very odd :face_with_monocle:

If you have any steps I can follow to reproduce this bug, let me know and I can see if there is consistent behavior. Which I can show to our engineering team in a bug report.

Apologies again for the inconvenience of having to clear local storage and cookies.

No worries, I'll keep an eye out for a set or reproduction steps, but i haven't noticed anything consistent so far. The only thing I can think of is that I was explicitly setting _environment=staging as a url param, and it started happening after that.

1 Like

Ok thanks, good to know.

I wouldn't expect setting url params to cause that but maybe the app's internal state got confused as it was only expecting env changes to be caused by button press and the url params changes the app and got things out of sync? :thinking: