unsupported protocol scheme "worker.http"
thomasf1 opened this issue · comments
I´ve set up the project with the following settings:
export APP_ENGINE_EMULATOR_HOST=http://localhost:8080
go run ./ -host localhost -port 8081 -queue projects/dev/locations/here/queues/emails
Everything seems to go well calling it from my local gae server, but invoking calls back to the local server for some reason seem to add a "worker." to the URL, can´t quite figure out why... This is the error:
Post "worker.http://localhost:8080/my/path": unsupported protocol scheme "worker.http"
2021/01/04 06:03:39 Task exec error with status -1
Got any ideas?
I found some possible issue, I´ve been using the code from the google examples to make the call, which includes this:
task = {
'app_engine_http_request': {
'http_method': tasks.HttpMethod.POST,
'relative_uri': '/my/path',
'app_engine_routing': {
'service': 'worker'
},
'body': params.encode()
}
}
Hey @thomasf1, ooks like I've made a mistake in the formatting of the target service. Will look into it. Thanks for reporting.
The problem is a bit trickier than I hoped, but basically localhost appengine emulation doesn't support targeting subdomains for services (e.g. worker.localhost). Instead, it hosts different services on different ports.
So I think it probably makes most sense to ignore the service, version and instance arguments in the case of local emulation; I'll raise a PR for that change.
However, this does mean that if you still want to target a different service you have a few options:
- Explicitly set the appengine routing
host
in the task and target the right service port (e.g.localhost:8081
) - Utilize appengine dispatch and include the target worker via a different
relative_uri
in the task (e.g./worker/my/path
) - If you only intend to target the one service, update the
APP_ENGINE_EMULATOR_HOST
to point to that service (e.g.localhost:8081
).