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 {