+1 I’m hitting this exact problem. The only environment variables my function picks up are those set through the netlify UI.
In the netlify docs, I found it suspicious that this sentence doesn’t mention that environment variables set in toml are picked up by functions:
Environment variables set in the UI are also accessible in other environments associated with your site, including serverless functions at runtime, snippet injection during post processing, and more.
I’ve tried the following toml settings with no luck:
[build.environment]
[context.branch-deploy.environment]
[context.my-branch-name.environment]