Jon has as usual done an incredible job of providing a very similar answer to the one Netlify’s staff would have. The “missing piece” is one we’re working on writing up right now - TL;DR we only automatically “forward” environment variables from our UI, NOT from netlify.toml (nor automatically set like “$COMMIT_REF”), to functions. The plugin Jon linked is a good way to get there, or you can manually interpolate the variables as explained in this article:
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| How to set up environment variables? | 8 | 5986 | February 17, 2020 | |
| Accessing build environment variables from lambda functions | 5 | 783 | December 22, 2022 | |
| Are envs set in build plugins available during function runtime? | 16 | 2568 | February 1, 2021 | |
| Environment/context availability at runtime | 4 | 947 | July 30, 2019 | |
| Netlify.toml context env variables do not apply to functions | 17 | 6450 | November 17, 2022 |