title: Salesforce data streaming to google cloud bigQuery tables
body: <p>I am trying to do an APEX Trigger Callout using POST to Google Cloud. The problem I have is: whenever the trigger happened, I see the authentication is happening fine, but message is coming as "Undefined" only from Stackdriver logs, hence the cloud function will fail since the message should be in JSON format. Not sure why it is happening. I am pretty much new to Salesforce. Please provide some hints on this.</p>
  
  <p>If I test the cloud function directly (Using Testing option inside cloud function), I see the insert to BigQuery table as expected, but from Salesforce trigger it seems, the message is not being captured properly. PFB Codes used in Salesforce.Expecting the same message which we are inserting into LEAD table in Salesforce as Rest API request </p>
  
  <p>Salesforce Class:</p>
  
  <pre><code>Public class Callout {
    @future(callout=true)
    Public static void httpcallout(){
      Lead c = [Select Name from Lead Limit 1] ;
      system.debug('Halo Trigger');
      JSONGenerator gen = JSON.createGenerator(true);   
      gen.writeStartObject();     
      gen.writeStringField('Name', c.Name);
      gen.writeEndObject();   
      String jsonS = gen.getAsString();
      System.debug('jsonMaterials'+jsonS);
      String endpoint = 'https://us-central1-valid-weaver- 235212.cloudfunctions.net/Salesforce-GCP';
      HttpRequest req = new HttpRequest();
      req.setEndpoint(endpoint);
      req.setMethod('POST');
      req.setbody(jsonS);
      Http http = new Http();
      HTTPResponse response = http.send(req);
    }
  } 
  </code></pre>
  
  <p>Salesforce Trigger</p>
  
  <pre><code>trigger SFGCP on Lead (after insert) {
    callout.httpcallout();
    system.debug('Hello');
  }
  </code></pre>
  
  <p>Debug from Salesforce</p>
  
  <pre><code>Lead c = new Lead(Company ='Test',LastName='Admin');
  insert c;
  </code></pre>