Environment variable per branch for lambda functions

$CONTEXT is not set in the UI, thus not available per the workaround discussed above. I apologize since I did not realize that when I posted my initial workaround. I think you’ll need a workflow more like this:

  1. Instead of trying to use the environment variable, use its value
  2. You can save the value during build using a pattern like the one shown here (literally for $CONTEXT): [Support Guide] Using environment variables on Netlify correctly
  3. You can do that across many files, using a search-and-replace setup something like sed -i s/PLACEHOLDER/${CONTEXT}/g function-source/*/*.js