Knowing the current public hostname of a Netlify function

So the hostname of the lambda function is available inside the context object. Here’s an example of how to do it: deploy-id-test/getdeploy.js at master · depadiernos/deploy-id-test · GitHub

function extractNetlifySiteFromContext(context) {
  data = context.clientContext.custom.netlify
  decoded = JSON.parse(Buffer.from(data, "base64").toString("utf-8"))
  return decoded
}

Let me know if that helps.

1 Like