Saving and retreiving variables
Hi all,
I have a problem with setting, getting and deleting environment project variables. The code provided in the docs works for setting variables, however getting does not work in prod. I'm talking about project scope since workflow scope does not seem to work as well, as pointed out by another user.
This is the code I'm talking about:
export default function testFunctions({ value }, { env }) {
const secondValue = env.get('second', 'project'); // project
console.log(
secondValue: ${secondValue}
);
// use the values in the node as you like, or return them
return true;
}
I modified the code to take a dynamic variable name as input:
export default async function retrieveEnvironmentVariable({
variableName
}, {
env,
logging
}) {
try {
const value = await env.get(variableName, 'project');
return value;
} catch (e) {
logging.log(e);
return null;
}
}
This works fine when testing the node however, it always returns undefined in prod.
What am I doing wrong?0 Replies