$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:
- Instead of trying to use the environment variable, use its value
- 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
- You can do that across many files, using a search-and-replace setup something like
sed -i s/PLACEHOLDER/${CONTEXT}/g function-source/*/*.js