1.I have a sns service which is running on Google App Engine

2.The sns service is using go to run as the back ending side

3.The sns service is using a crob job to request Api A

4.The Api A is adding another http request(request to Api B) into taskqueue

5.The taskqueue is executed immediately after the request of Api A

6.The request of Api B is executed

7.The Api B responded with the code 308

Problem Summary

job cron(request for Api A) -> Api A -> Task queue(stack request for Api B) ->Api B -> some execution

Api A responded with 200 Api B responded with 308


Why Api B is respond with the code of 308?


By the way the following sequence is successful

post man (request for Api A) -> Api A -> Task queue(request for Api B) ->Api B -> some execution

Api A responded with 200 Api B responded with 200

When I use post man to request Api A the following request for Api B was respond with 200

The way I did with taskqueue is like

    params := url.Values{}
    params.Set("dollSpaces", strings.Join(dollSpaces, ","))
    t := taskqueue.NewPOSTTask("/path", params)
    req.Header.Set("X-AppEngine-QueueName", "mailqueue")
    c := appengine.NewContext(req)
    taskqueue.Add(c, t, "my queue")

The Log from Google Cloud Platform is like the following

Response of Api A

2019-01-01 10:00:00.001 JST
193 B
577 ms
AppEngine-Google; (+
/path/ApiAPath - - [01/Jan/2019:10:00:00 +0900] "GET /path/ApiAPath HTTP/1.1" 200 193 - "AppEngine-Google; (+" "" ms=577 cpu_ms=3 cpm_usd=2.8039999999999998e-8 loading_request=0 instance=asda1231313asdasd123123asda123 app_engine_release=1.9.71 trace_id=123123123dsfasf123123zafasdasd

Response of Api B

2019-01-01 10:00:00.100 JST
95 B
2 ms
AppEngine-Google; (+
/ApiBPath - - [01/Jan/2019:10:00:00 +0900] "POST /ApiBPath HTTP/1.1" 308 95 "AppEngine-Google; (+" "" ms=2 cpu_ms=221 cpm_usd=1.3802e-8 loading_request=0 instance= asda1231313asdasd123123asda123 app_engine_release=1.9.71 trace_id= 123123123dsfasf123123zafasdasd

0 Answers