bruno icon indicating copy to clipboard operation
bruno copied to clipboard

"Generate code" command not working with env variables

Open ftrudeau-pelcro opened this issue 11 months ago • 4 comments

Version: Windows v1.10.0

Actual behavior: Screenshot (282)

Expected behavior: For this to work I guess ¯_(ツ)_/¯

ftrudeau-pelcro avatar Mar 12 '24 01:03 ftrudeau-pelcro

Hi @ftrudeau-pelcro ! can you confirm if you have selected the right environment, in which those env variables are available I can only replicate it when I select the wrong environment or not select any environment at all.

therealrinku avatar Mar 16 '24 15:03 therealrinku

can you confirm if you have selected the right environment, in which those env variables are available

I confirm.

The correct environment is selected (I only have one anyway), the .env file exists, variables exists and are populated with their intended values.

Let me know if you need something else to diagnose.

ftrudeau-pelcro avatar Mar 16 '24 17:03 ftrudeau-pelcro

Hello,

We are facing the same issue here while using bruno :) Here is a screenshot of what is happening when we try to generate code with env variables.

I checked the console for eventual errors but got none.

Let met know, if you need more details.

Thank you

Bruno_WgQqJ5f9ht Bruno_FK3VIfQ47U

Wassim24 avatar Apr 08 '24 15:04 Wassim24

Hi @Wassim24 does this happen everytime or there is any specific steps that need to be followed to replicate this error ? because I wasn't able to replicate this :(

therealrinku avatar Apr 08 '24 15:04 therealrinku

Hello @therealrinku It happens only when using environment variables through an env file.

In my case:

  • I have a .env file containing all my secrets.
HOST=myhost
API_KEY=key
  • I have my environment file PROD.bru defining the variables I need for my collection. For example :
vars {
  host: {{process.env.HOST}}
  api_key: {{process.env.API_KEY}}

After that, I create my requests using the vars defined per environment.

When trying to generate the code, i get the error shown in the previous screenshots.

I hope it helps :)

Wassim24 avatar Apr 19 '24 10:04 Wassim24