Nexts api context environment variable

Do you have a functions directory setup in netlify.toml?

It should look like:

[functions]
  directory = "your functions folder"

[[plugins]]
  package = "netlify-plugin-inline-functions-env"
  [plugins.inputs]
    include = ["CONTEXT"]