Why is a process.env Variable Outputting Null in a Specific Nodejs Module Despite Being Passed In?

This topic was automatically generated from Slack. You can find the original thread here.

Not sure what I am doing wrong here, but I am outputting a process.env variable and it comes out null. I can see it being passed in, and it appears in the code hints. I even have a second Nodejs code function that it works in, so why would this particular step/module not output the value?

I couldn’t reproduce your issue (not sure I understand your issue).

I configure my variables and see the output as normal

Is the process.env code outside of the async run function? It has to be inside to have the correct context

Its the very first line of code inside the async run. If I take just that line and put it it its own Node component it returns a value ok (second screenshot)

Oh is that a private action you’re intending to publish? I believe private actions do not have the same context as custom code steps in the workflow

Just tested it and it doesn’t log the environment variable if I add the name, description, key, type properties

You can do it via props though! Add a prop for your API Key, e.g.

api_key: {
  type: "string",
  label: "API key",
  secret: true,
},

And in the UI configure the prop as {{process.env.VirusTotalAPI}}

Yes private action, ok thanks, I will try that.