I'm trying to pre-render metas with google cloud functions but I can't figure out how to acces the values, the data log returns this on the functions console (see link)

exports.preLoadMeta = functions.https.onRequest((request, response) => {
let id = request.url.split("/");
let data;
admin.database().ref('proyectos').orderByChild("urlAmigable").equalTo(id[2]).once("value")
.then(proyectos =>{
data = proyectos.val();
console.log(data)
}).then( () => {
response.status(200).send(`
<!doctype html>
<html class="no-js" lang="es" dir="ltr">
<head>
<title>${data.titulo}</title>
<meta name="description" content="bla bla - ${data.titulo}" />
<meta property="og:title" content="${data.titulo}" />
<meta property="og:description" content="${data.meta}" />
<meta property="og:image" content="${data.imgUrl}" />
<meta property="og:type" content="article" />
`);
})
})
(this does not work)