Home
Support Forums

How to get branch specific details in lambda functions?

i need to check if the branch is staging or production in a lambda function, how should it be done ?

Hi @abhidj0090,

You could use process.env.CONTEXT and that would give you if it’s production or branch-deploy or any context that you set in netlify.toml.

1 Like

I am not getting that context value in env how to set it in the toml file ?

You’re probably looking for this: GitHub - bencao/netlify-plugin-inline-functions-env: Inline build time environment variable values into netlify function code so that it becomes available at runtime.

1 Like

will have a look many thanks :smiley:

worked like a charm, I spent the better part a day trying to get this :sob: thanks @hrishikesh

1 Like