CodeIgniter - PHP Push Tasks giving different outcomes

71 views
Skip to first unread message

Paul Canning

unread,
Nov 12, 2015, 12:42:42 PM11/12/15
to Google App Engine
I have a CI app and I am trying to get Push Tasks to work.

I have a controller, controller_a, with a method, method_a, which tells GAE to add a task to the queue, to hit controller_a/method_b, with a basic payload. Method_b simply writes a file to GCS (using verified working code).

Now, my tasks appear, but always return as a 302 response. Method_a is fully accessible, checking the logs shows a 200 response.

I can even actually go to controller_a/method_b and see a 200 response in the logs (obv. the POST data is missing).

Now, this is where it gets weird. I made a full fresh install of CI and made a basic task example, as above.

It works. 100%. I put in on a new module, and even made a new, non-default version to check. And it always works.

Below are the responses I got from the working and non-working tasks.

I simply cannot figure out for the life of me whats wrong.

Both CI installs are the same version, 2.2.6.

The non-working one *does* have additional CI routes and URL handlers in the app.yaml, but none that go near the task methods.

Working:

0.1.0.2 - - [12/Nov/2015:08:44:22 -0800] "POST /tasks/test HTTP/1.1" 200 25 https://ci-test-dot-myapp.appspot.com/ "AppEngine-Google; (+http://code.google.com/appengine)" "ci-test.myapp.appspot.com" ms=623 cpu_ms=111 cpm_usd=2.7929999999999998e-06 instance=00c61b117c97eae25cc3ab600a819360a37cb04b app_engine_release=1.9.29 trace_id=-

0.1.0.2 - - [12/Nov/2015:09:09:19 -0800] "POST /tasks/test HTTP/1.1" 200 25 https://1-1-dot-ci-test-dot-myapp.appspot.com/ "AppEngine-Google; (+http://code.google.com/appengine)" "1-1.ci-test.myapp.appspot.com" ms=645 cpu_ms=107 cpm_usd=2.7929999999999998e-06 instance=00c61b117c91285c5c7991b03cfef45e55459cf8 app_engine_release=1.9.29 trace_id=-

Non- Working:

0.1.0.2 - - [12/Nov/2015:09:00:48 -0800] "POST /cleanup/task HTTP/1.1" 302 563 http://1-4-dot-ci-app-dot-myapp.appspot.com/ "AppEngine-Google; (+http://code.google.com/appengine)" "1-4.ci-app.v.appspot.com" ms=31 cpu_ms=35 cpm_usd=6.292e-05 instance=00c61b117ce404978751535a24ad4d36a6c8c4 app_engine_release=1.9.29 trace_id=5641c0ed69cda78c99e147d41f7aae05

Joshua Johnston

unread,
Nov 12, 2015, 2:22:28 PM11/12/15
to Google App Engine
Can you show us what the handlers section of your yaml looks like for the non-working module?

Paul Canning

unread,
Nov 13, 2015, 5:00:25 AM11/13/15
to Google App Engine
Nevermind, I think I got it sussed.

My controller was locked down so only logged in admins could trigger the task, and so was the end point. Obviously the Task Queue could not be logged in, so it failed.

I'm guessing the best way to secure a task end point is to set a handler and use login: admin?

Joshua Johnston

unread,
Nov 13, 2015, 8:45:01 AM11/13/15
to Google App Engine
login: admin is the way we do them as well.

Paul Canning

unread,
Nov 13, 2015, 9:00:28 AM11/13/15
to Google App Engine
Yea, I may also implement checking the request headers that the push tasks queue sets.

Cheers!
Reply all
Reply to author
Forward
0 new messages