Google App Engine Node.js应用程序不健康 [英] Google App Engine Node.js Application Unhealthy
问题描述
我试图在谷歌应用程序引擎上测试一个相当直接的node.js应用程序。如下所示,它所要做的就是收听Firebase数据库中的更改,然后向用户发送GCM消息:
var Firebase = require(firebase);
var gcm = require('node-gcm');
//创建对推送通知队列的引用
var ref = new Firebase(firebaseDB);
var message = new gcm.Message();
var regTokens = ['用户GCM reg令牌'];
//设置发件人API key
var sender = new gcm.Sender('GCM sender ID');
message.addData('syncNewData','Hello Member!');
$ b ref.on(value,function(snapshot){
//现在发送者可以用来发送消息
sender.send(message, {registrationTokens:regTokens},function(err,response){
if(err)console.error(err); $ b $ else console.log(response);
});
console.log(snapshot.val());
},function(errorObject){
console.log(The read failed:+ errorObject.code);
});
但是,每次我尝试部署到应用程序引擎时,该过程都会平稳运行,直到更新模块[默认] ... /
,运行几分钟,出现错误:
错误:(gcloud.preview.app.deploy)错误响应:[13]启动
个虚拟机时超时。应用程序代码可能不健康。 (准备好0/2,仍然需要
部署)。
我对node.js以及appengine相当陌生,但我只是试图测试确保所有组件一起工作。
为什么会出现这个错误?
在App Engine中运行时,您在应用程序启动期间发生崩溃。我们今天在部署期间并不擅长处理这类崩溃(正在开展这方面的工作)。要查看发生了什么:
- 转到
- 查找
crash.log
或stderr
:
<这就是你通常会发现问题的地方。希望这有助于!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?
解决方案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:
- Go to the developers console
- Click on cloud logging
- Look for a
crash.log
orstderr
:
That's where you'll usually find the problem. Hope this helps!
这篇关于Google App Engine Node.js应用程序不健康的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- 查找