const axios = require('axios');
const querystring = require('querystring');

exports.handler = function (event, _context, callback) {
  if (process.env.NODE_ENV !== 'production') {
    require('dotenv').config();
  }

  console.log("Logging inside functions ", process.env.TEST);

  const apiToken = process.env.API_TOKEN;
  const query = querystring.stringify(event.queryStringParameters);

  // Only use an authorization header if there is an apiToken defined from the .env file
  const configHeader =
    typeof apiToken === 'undefined'
      ? null
      : {
          headers: { Authorization: 'bearer ' + apiToken },
        };

  axios
    .get(`https://api.github.com/search/issues?${query}`, configHeader)
    .then((response) => {
      callback(null, {
        statusCode: 200,
        body: JSON.stringify(response.data),
      });
    })
    .catch((error) => {
      console.log(error);
    });
};

const axios = require('axios');
const querystring = require('querystring');

exports.handler = function (event, _context, callback) {
  if (process.env.NODE_ENV !== 'production') {
    require('dotenv').config();
  }

  console.log("Logging inside functions");
  
  const apiToken = process.env.API_TOKEN;
  const query = querystring.stringify(event.queryStringParameters);

  // Only use an authorization header if there is an apiToken defined from the .env file
  const configHeader =
    typeof apiToken === 'undefined'
      ? null
      : {
          headers: { Authorization: 'bearer ' + apiToken },
        };

  axios
    .get(`https://api.github.com/search/issues?${query}`, configHeader)
    .then((response) => {
      callback(null, {
        statusCode: 200,
        body: JSON.stringify(response.data),
      });
    })
    .catch((error) => {
      console.log(error);
    });
};

--- 
+++ 
@@ -6,8 +6,8 @@
     require('dotenv').config();
   }
 
-  console.log("Logging inside functions");
-  
+  console.log("Logging inside functions ", process.env.TEST);
+
   const apiToken = process.env.API_TOKEN;
   const query = querystring.stringify(event.queryStringParameters);
 
Test env variable in function
