Hi all, I think the issue here is attempting to read the variable via process.env
from custom UI - it was only designed to work from forge functions (such as UI Kit resolvers). See Trying to add .env to a forge Custom UI app - #2 by dmorrow for more.
Custom UI code is run in the browser. What process.env
actually returns when you call it depends on what polyfill the bundler has set up, because there’s no global process
variable available in the browser. Normally the bundler will substitute whatever environment variable values it can see while it’s performing the bundling.
You could invoke a forge function and have it retrieve the variable values of interest for you, but if you want to avoid the network call another thing you could try is wrapping your deployment step in a script that pulls down the current forge variable values and sets them somewhere that the bundler can find them (either in the currently executing environment or some kind of property file).