You cannot “stack” variables like that unless you do some very special parsing. We don’t interpolate for you, so as you see, you’ll get the string literal rather than the interpretation of an interpretation. Kinda like if you set $vara="$varb" - it’s a string
You could try something like this:
create a shell script for your build
in the shell script, use your normal build command but first set up the environment.
I haven’t tested this but something like this may work:
#!/bin/sh
export GATSBY_URL=$URL GATSBY_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL GATSBY_DEPLOY_URL=$DEPLOY_URL
npm run build
Effectively, since in our UI those are strings, you need to programatically dereference or interpolate your variables. What I suggested may or may not work but something like that could
All I need is to access the site url (be it a preview or my custom domain) during the build stage so I can provide an absolute path for the og:image instead of /img/og-image.jpg@fool
This will show what the environment is before yarn runs - you should see $REACT_APP_URL set in the output from env. IF that is the case, you’ll want to troubleshoot why yarn doesn’t “pass that on” to the build - I did a similar test and saw my test variable set before the build. I don’t have a sample react site to test, but whatever happens inside of yarn/react isn’t really Netlify specific, as long as we have the variable set before the build our system is working as intended and in the way that other systems should work too.