Hello,
I have and secret “sendgrid_api_key” defined in Realm UI!
Screenshot 2020-12-07 at 00.17.35|690x282
When I try to get this value inside the function it returns undefined.
exports = async (username, tokenId, token) => {
console.log("sendgrid_api_key", context.values.get("sendgrid_api_key"));
const body = {
personalizations: [{ to: [{ email: username }] }],
from: { email: "test@test.com" },
subject: `Hi ${username} reset email`,
content: [
{
type: "text/plain",
value: "test",
},
],
};
return context.http.post({
url: "https://api.sendgrid.com/v3/mail/send",
headers: {
Authorization: [`Bearer ${context.values.get("sendgrid_api_key")}`],
},
body: JSON.stringify(body),
encodeBodyAsJSON: true,
});
};
Executing this function logs sendgrid_api_key undefined
What am I doing wrong?