I cannot get the appengine taskqueue to accept any context I throw at it:
import (
"context"
"google.golang.org/appengine"
"google.golang.org/appengine/taskqueue"
)
/* snip */
ctx:= context.Background()
task := taskqueue.NewPOSTTask("/b/mytask", params)
_, err = taskqueue.Add(ctx, task, "")
if err != nil {
return fmt.Errorf("adding background task with path %s: %v", task.Path, err)
}
I'm calling appengine.Main() in my main.go main func as stated by the go111 migration docs (But this line is missing in go112 migration docs so I'm not sure it's required).
I've tried:
context.Background()
request.Context()
appengine.NewContext(r)
appengine.BackgroundContext()
context.TODO()
All result in error:
not an App Engine context
except for appengine.BackgroundContext()
which gets:
service bridge HTTP failed: Post http://appengine.googleapis.internal:10001/rpc_http: dial tcp 169.254.169.253:10001: i/o timeout