Changing environments with OpenAPI resources does not work as expected

When working with resources of type OpenAPI and staging/production environments, you can set different server variables in the "resource" tab.

This is especially useful since you could toggle between server urls.

However the experience I'm getting is that the server variable used is saved with the query hence toggling between production & staging doesn't change the server variables.

My current workaround is that I have to use the retoolContext.environment variable to set this within each query that uses this openapi resource something like this:

serverUrl = {
  staging: 'staging.example.com/api', 
  production: 'prod.example.com/api'
}[retoolContext.environment]

Our environment is on-premise deployment with image: tryretool/backend:2.84.21

Hi @hagalin Thanks for reaching out about this!

I'll post on this thread when engineering ships a fix

The fix for this is available on Retool Cloud :blush: Let me know if you run into any questions or blockers

1 Like