Hello Nicholas, Thanks for your answer. Indeed the error is transient, as it happened only once in the last 6 months. I will not hesitate to contact you if it happens again, as you suggest.
Thanks also for the code example. I've realized that actually I do not use the promises "mode" but the callback "mode" of the API Client Library for JavaScript. I call the endpoints the same way it is shown in this Google example https://cloud.google.com/appengine/docs/java/endpoints/calling-from-javascript, i.e. like: gapi.client.myOwnApi.get(requestData).execute(function (resp) { if (!resp.code) { //success } else { //error } }); In the documentation of the JS Library you linked to, it is "strongly recommend" to "use promises instead of callbacks". I guess you would recommend so! Thanks in advance for your answer, Renaud On Thursday, April 28, 2016 at 7:37:06 PM UTC+2, Nicholas (Google Cloud Support) wrote: > > Thanks for posting your issue here and providing some context. It's > difficult to know exactly what the error is, especially if it's transient. > > From what I understand, the client is making requests to your Cloud > Endpoints using the API Client Library for Javascript. If this is the case, > the generic way of issuing such requests is using the > gapi.client.request(args) > <https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiclientrequestargs> > > method. This returns a promise with which to use the then() or execute() > methods. > > Unfortunately, the documentation > <https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiclientRequest> > > for both those methods does not state explicitly under what conditions it > would return the values you received. From this, it's fair to suspect those > values are actually returned from the server and not an issue with the > Javascript API. This could be confirmed by inspecting the network requests > using Chrome Developer Tools > <https://developer.chrome.com/devtools#improving-network-performance> and > looking at the raw response. > > That being said, if it's confirmed to be a response from the server and is > reproducible, please feel free provide the Endpoints code that causes this > so we can attempt to reproduce and identify the root cause. Also, please > test this endpoint using the API Explorer. If it's very rare, I would > suggest adding some retry system to your front end to account for network > issues like this. An example follows: > > var request_args = { > 'params': { > 'q': 'search_values' > }, > 'path': 'path/to/resource' > }; > > > function success(response) {} > function failure(reason) { > console.error(reason); > } > > > var promise = gapi.client.request(request_args).then(success, function ( > reason) { > failure(reason); > console.debug('retrying'); > setTimeout(function () { > gapi.client.request(request_args).then(success, failure); > }, 500); > }); > > > Hope this helps. Let us know if you continue to experience this network > error and can confirm it's a platform issue or if you have any other > questions on the subject. > > On Wednesday, April 27, 2016 at 3:43:17 PM UTC-4, Renaud Tarnec wrote: >> >> Hello, >> >> Today, after calling one of my Endpoints from a web page through the >> JavaScript API I got the following values for the response from the API: >> >> resp.code: -1 >> >> resp.message: A network error occurred, and the request could not be >> completed. >> >> This endpoint saves an entity in the Datastore with Objectify and adds a >> Task to a Queue (all within an Objectify transaction). Actually the code >> was executed correctly, despite the error message (i.e. the entity was >> saved in the Datastore and the task executed correctly). >> >> It's the first time I encounter this error, and its several months I work >> on this application. Right after I was able to call the API the same way >> without anymore problems. >> >> Any explanations or recommendations? >> >> Many thanks in advance >> Renaud >> >> -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/1a9498bd-51b2-4519-842b-f58e31337695%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
