I have a Forge app that uses the trigger module to get callbacks when issues change. I’m trying to access a set environment variable from the function that’s run from one of these event triggers, and it’s consistently undefined.
My manifest.yml
looks like this:
modules:
trigger:
- key: issue-update-trigger
function: app-issue-events-func
events:
- avi:jira:updated:issue
function:
- key: main
handler: index.run
- key: app-issue-events-func
handler: index.issueUpdate
I set the variable with:
forge variables set FORGE_USER_VAR_NAME value
And my function looks like:
import * as process from 'process';
export async function issueUpdate(data) {
const nameVar = process.env.FORGE_USER_VAR_NAME;
console.log(nameVar);
// undefined
}
Is it not possible to access environment variables from trigger functions?