URL: https://relaxed-euclid-50b68f.netlify.app/
Function URL: https://relaxed-euclid-50b68f.netlify.app/.netlify/functions/generate-og-image?image=%2Fimages%2Fpastrami.jpeg&title=Pastrami%20Sandwich
I’m looking to retrieve images tracked in Git LFS from a serverless function, primarily for using the posts ‘Featured Image’ property while generating an og:image
When requesting the file from the endpoint directly, I receive a 401 response due to it being unauthenticated.
const downloadImage = (url) => {
request.get(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
const data = "data:" + response.headers["content-type"] + ";base64," + Buffer.from(body).toString('base64');
console.log('DATA: ', response);
return data;
} else {
console.log('DOWNLOAD IMAGE ERROR: ', error, response);
}
});
}
const profileImage = downloadImage(`${GIT_LFS_ENDPOINT}/images/rotated-logo.svg`);
// Returns null error, but the response statusCode is 401 Unauthorized
Can anybody help me with this?