From 4cd04235783c879c38c773c199d373f78e4b1d85 Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Tue, 15 Aug 2023 10:12:56 -0500 Subject: [PATCH] Added api-key header. --- netlify/functions/nerdgraph/nerdgraph.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netlify/functions/nerdgraph/nerdgraph.ts b/netlify/functions/nerdgraph/nerdgraph.ts index e5e9ac8..c5243b1 100644 --- a/netlify/functions/nerdgraph/nerdgraph.ts +++ b/netlify/functions/nerdgraph/nerdgraph.ts @@ -7,7 +7,7 @@ export const handler: Handler = async (event: HandlerEvent, context: HandlerCont case 'POST': const apiKey = event.headers['api-key']; const query = event.body; - const response = await axios.post('https://api.newrelic.com/graphql', // use account token to get a temp user token + const response = await axios.post('https://api.newrelic.com/graphql', query, {headers: {'Api-Key': apiKey, 'Content-Type': 'application/json'}}); const data = await response.data; @@ -20,7 +20,7 @@ export const handler: Handler = async (event: HandlerEvent, context: HandlerCont case 'OPTIONS': const headers = { 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Headers': 'Content-Type', + 'Access-Control-Allow-Headers': 'Content-Type, Api-Key', 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE' }; return {