How to use Netlify Functions `context` parameter on build

In the documentation we have a description of lambda functions like the following:

exports.handler = async function(event, context) {
    // your server-side functionality

The context parameter includes information about the context in which the function was called, like certain Identity user information, for example.

I would like to know more about the context capability other than the Identity pupose.
Is this reserved only for Netlify internal usage/tools or can we use it on our side to add some capability?
Can we populate that context for all or a set of our lambda functions with a prebuild plugin?

In our case we are looking to set constants retrieved from our content provider on build. This would allow us to avoid querying that content provider at every execution of lambdas and keep those constant up to date at every site build.

At the moment, the context object is not writeable to. It’s pre-populated with AWS and Netlify-specific stuff.

We could add this as a feature request, but we do not know if/when this will be implemented.

1 Like

Thank you!

This could definitely be a great addition although I guess not a priority.
Maybe can you add mention on the doc about this, that would be quite helpful to others I guess!