My goal is to insert into bigquery the result of a post request using google cloud function.

My problem is that the cloud function is inserting null values into my table so it's not able to get back the parameters from the post request.

Here is my post request:

```
<script>
var event_category = 'action';
var event_name = 'click';
var page_url = 'test'
var request = new XMLHttpRequest();
request.open('POST', 'url to my cloud function');
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        params = {
              event_category: event_category, 
              event_name: event_name, 
              page_url: page_url
              } 
request.send( JSON.stringify(params));
console.log(JSON.stringify(params));
</script>

```

Code of the google cloud function

```
const bigquery = require('@google-cloud/bigquery')();
var result = "";

function insertHandler(err, apiResponse) {
  result.writeHead("204",
   "No Content",
   {
     "access-control-allow-origin": "urlofmywebsite",
     "access-control-allow-methods": "GET, POST, OPTIONS",
     "access-control-allow-headers": "content-type, accept",
     "access-control-max-age": 10, // Seconds.
     "content-length": 0
   }
);
return(result.end());
}

exports.loadBQ = function loadBQ (req, res) {
  result = res;
  var dataset = bigquery.dataset("google_analytics_test"); 
  var table = dataset.table("google_tag_manager"); 
  var event_category;
  var event_name;
  var page_url;

  try{
      event_category = req.body.event_category;
      event_name = req.body.event_name;
      page_url = req.body.page_url;
    var row = {
      json: {
        event_category : event_category,
        event_name: event_name,
        page_url: page_url
      }
    };
    var options = {
      raw: true
    };
    table.insert(row, options, insertHandler);
  } catch(e){insertHandler(true, false)};
};

```

As said earlier the problem reside on reading the post request from the google cloud function , not sure how to unblock that