0
votes

I have deployed myapp to Google App Engine, with setting

runtime: nodejs
env: flex

My app domain is

https://myapp.appspot.com

but it is auto redirected to

https://myapp.appspot-preview.com

I have also created Google Pub/Sub topic and add subscription, set Push endpoint url to

https://myapp.appspot-preview.com/_ah/push-handlers/sample

tested this endpoint_url with postman and it's sure work well, however when I publish message to Pub/Sub but nothing works.

MyApp (Node.js) endpoint handler:

var cors = require('cors');
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var http = require('http').Server(app);
var io = require('socket.io')(http);

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(cors());

app.post('/_ah/push-handlers/sample', function (req, res){
        console.log('PUBSUB_____',req.body); //this should be printed out
        res.status(200).send();
});

//Listener
io.on('connection', function (socket){
        // do something 
});

var server = http.listen(8080, function(){
      console.log('App listening on port %s', server.address().port);
});

This is the logs of GAE, it seems pub/sub does send request to my endpoint but not go to my handler GAE request log

GAE console log

I appreciate any help :)

1
I wonder if env: flex setting causes this .... ?devil_may_die

1 Answers

1
votes

I found a similar issue to mine "Cannot receive push message in appengine flexible environment"

It does not work for us. I created a push subscription to https://{project-id}.appspot-preview.com/push/db/istock ant posted a message to this topic. After that I can see a lot of nginx /push/db/istock POST requests in the GAE App log, all with 307 code as before. Nothing changed. No requests passed to the GAE app

https://code.google.com/p/cloud-pubsub/issues/detail?id=49

The latest answer from dev team is

We have a fix that will be rolling out over the next couple of weeks. As an ETA this is subject to change and can be extended, but should be rolled out by January 21.