title: '500 - internal server error' response from firebase server on sending a downstream 'data' message
body: <p>I'm sending a downstream message to a single device from app server via Firebase server. I'm using the devices reg token that was passed to the apps server. app server code is</p>
  
  <pre><code>    $firebase_token = $request-&gt;input('token');
  
      $skey = env('FCM_SERVER_KEY');
  
      $client = new Client(['verify' =&gt; false]);
  
      $response = $client-&gt;request('POST', 'https://fcm.googleapis.com/fcm/send', [
          'headers' =&gt; [
              'Authorization:key=' =&gt; $skey,
              'Content-Type' =&gt; 'application/json'
          ],
          'json' =&gt; ['to' =&gt; $firebase_token, 'data' =&gt; ['message' =&gt; 'This is Genius']]
      ]); 
  </code></pre>
  
  <p>I'm receiving the following message from my android app (cause i'm testing out FCM and i'm sending the <code>$response</code> back to my app on the emulator.)
  Its the same message I'm getting on Postman.</p>
  
  <pre><code>{"message":
      "Server error: `POST https:\/\/fcm.googleapis.com\/fcm\/send` resulted in a 
      `500 Internal Server Error` response:\n
      &lt;HTML&gt;\n
          &lt;HEAD&gt;\n
              &lt;TITLE&gt;Internal Server Error&lt;\/TITLE&gt;\n
          &lt;\/HEAD&gt;\n
          &lt;BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"&gt;\n
              &lt;H1&gt;Internal ServerE(truncated...)\n",
  "code":500, 
  "status_code":500,"debug"
  ...
  </code></pre>
  
  <p>I'm using Laravel and Guzzle Client to deliver the message to the FCM server, I tried sending a message to my emulator from my Firebase console and it marked the message as completed but I didn't receive it on my app/emualtor. This is my <code>onMessageReceived</code> method inside my <code>FirebaseMessagingService</code> class  </p>
  
  <pre><code>public void onMessageReceived(RemoteMessage remoteMessage) {
      super.onMessageReceived(remoteMessage);
  
      showNotification(remoteMessage.getData().get("message"));
  }
  
  private void showNotification(String message) {
  
      Intent i = new Intent(this,MainActivity.class);
      i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  
      PendingIntent pendingIntent = PendingIntent.getActivity(this,0,i,PendingIntent.FLAG_UPDATE_CURRENT);
  
      NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
              .setAutoCancel(true)
              .setContentTitle("FCM Test")
              .setContentText(message)
              .setSmallIcon(R.drawable.com_facebook_button_send_icon_blue)
              .setContentIntent(pendingIntent);
  
      NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  
      manager.notify(0,builder.build());
  }
  </code></pre>
  
  <p>I'm not sure whats wrong with my setup. Any help will be appreciated. </p>