Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine Node.js Application Unhealthy

I am attempting to test a fairly straightforward node.js app on google app engine. As seen below, all it is intended to do is listen to a change in a Firebase database, and subsequently send a GCM message to a user:

var Firebase = require("firebase");
var gcm = require('node-gcm');

// Create a reference to the push notification queue
var ref = new Firebase("firebaseDB");

var message = new gcm.Message();

var regTokens = ['A user GCM reg token'];

// Set up the sender with you API key
var sender = new gcm.Sender('GCM sender ID');

message.addData('syncNewData', 'Hello Member!');

ref.on("value", function(snapshot) {

    // Now the sender can be used to send messages
    sender.send(message, { registrationTokens: regTokens }, function (err, response) {
        if(err) console.error(err);
        else    console.log(response);
    });

  console.log(snapshot.val());
}, function (errorObject) {
  console.log("The read failed: " + errorObject.code);
});

However, every time I attempt to deploy to the app engine, the process runs smoothly until Updating module [default].../, running for several minutes, whereby the error appears:

ERROR: (gcloud.preview.app.deploy) Error Response: [13] Timed out when starting
VMs.  It's possible that the application code is unhealthy.  (0/2 ready, 2 still
 deploying).

I am fairly new to node.js as well as appengine, but I am simply attempting to test to ensure all components work together.

Why would this error exist?

like image 701
Sauron Avatar asked Feb 27 '16 03:02

Sauron


1 Answers

This almost always means you have a crash during app startup when running in App Engine. We're not very good at surfacing these kinds of crashes today during deployment (working on that). To see what's going on:

  1. Go to the developers console
  2. Click on cloud logging

cloud logging

  1. Look for a crash.log or stderr:

crash.log

That's where you'll usually find the problem. Hope this helps!

like image 85
Justin Beckwith Avatar answered Oct 09 '22 17:10

Justin Beckwith