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 | |
---|---|---|---|---|
Node env or context not available in netlify function | 1 | 368 | September 29, 2021 | |
Netlify function environment variables returning undefined | 1 | 1071 | November 18, 2019 | |
Accessing build environment variables from lambda functions | 5 | 698 | December 22, 2022 | |
NODE_ENV and CONTEXT environment variables are `undefined` in my functions | 11 | 4430 | March 10, 2023 | |
Environment/context availability at runtime | 4 | 814 | July 30, 2019 |