Unexpected environment-variable

Answer is it depends! You’ll need to bring it into your function somehow. This article talks about some possibilities:

Do note that for functions, you will have to put the environment variable either into your code into our UI - the variables set in netlify.toml will NOT be available in functions!