I have created a simple API using Cloud Endpoints, which makes some translations using Google Translate API, caches them in Datastore and returns the list of results to Client. The problem is that each time I make a call, which uses Google Translate API I receive 502 Bad Gateway error. I've been debugging my endpoint from cloud console and the response is created successfully, so the 502 must be thrown when sending the result back to client. Another strange thing here is that I don't see 502 on any logging tool in Cloud Console.
I was trying to change region from europe-west to us-central, but no luck so far. Does anyone have any ideas, what may be wrong here?
My cofnig of GAE:
runtime: java7
env: standard
threadsafe: true
instance_class: B2
inbound_services:
- warmup
handlers:
- url: '(/.*/)'
application_readable: false
static_files: "__static__\\1index.html"
require_matching_file: true
upload: __NOT_USED__
- url: (/)
application_readable: false
static_files: "__static__\\1index.html"
require_matching_file: true
upload: __NOT_USED__
- url: '(/.*)'
application_readable: false
static_files: "__static__\\1"
require_matching_file: true
upload: __NOT_USED__
- url: /
script: unused
- url: '/.*/'
script: unused
- url: '/_ah/.*'
script: unused
basic_scaling:
idle_timeout: 900s
max_instances: 2
When changing configuration of GAE and removing basic-scaling I get from Google translate following error:
com.google.cloud.translate.TranslateException: com.google.apphosting.api.ApiProxy$CancelledException: The API call urlfetch.Fetch() was cancelled because the overall HTTP request deadline was reached.
at io.stringx.repository.DatastoreTranslationRepository.translate (DatastoreTranslationRepository.java:53)