Added logging to debug.
This commit is contained in:
parent
f2ada3bdd3
commit
6112f30363
@ -4,18 +4,22 @@ import axios from 'axios';
|
|||||||
export const handler: Handler = async (event: HandlerEvent, context: HandlerContext) => {
|
export const handler: Handler = async (event: HandlerEvent, context: HandlerContext) => {
|
||||||
try {
|
try {
|
||||||
const apiKey = event.headers['Api-Key'];
|
const apiKey = event.headers['Api-Key'];
|
||||||
|
console.log(apiKey.substring(-5));
|
||||||
const query = event.body;
|
const query = event.body;
|
||||||
|
console.log(query);
|
||||||
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', // use account token to get a temp user token
|
||||||
query,
|
query,
|
||||||
{headers: {'Api-Key': apiKey, 'Content-Type': 'application/json'}});
|
{headers: {'Api-Key': apiKey, 'Content-Type': 'application/json'}});
|
||||||
|
|
||||||
const data = await response.data;
|
const data = await response.data;
|
||||||
|
console.log(data)
|
||||||
return {
|
return {
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
return {
|
return {
|
||||||
statusCode: 500,
|
statusCode: 500,
|
||||||
body: JSON.stringify(error)
|
body: JSON.stringify(error)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user