GRPC target method can't be resolved

825 views
Skip to first unread message

g.bal...@solid55.com

unread,
Jul 31, 2018, 10:50:46 AM7/31/18
to grpc.io
#include <grpc++/grpc++.h>
#include <strings.h>

#include
#include
#include
#include

#include "parse_arguments.h"
#include "google/cloud/texttospeech/v1/cloud_tts.grpc.pb.h"

using google:cloud:texttospeech::v1::TextToSpeech;
using google:cloud:texttospeech::v1::AudioConfig;
using google:cloud:texttospeech::v1::SynthesisInput;
using google:cloud:texttospeech::v1::SynthesizeSpeechRequest;
using google:cloud:texttospeech::v1::SynthesizeSpeechResponse;
using google:cloud:texttospeech::v1::ListVoicesRequest;
using google:cloud:texttospeech::v1::ListVoicesResponse;

int main(int argc, char** argv) {
auto creds = grpc::GoogleDefaultCredentials();
auto channel = grpc::CreateChannel("speech.googleapis.com", creds);
std::unique_ptrTextToSpeech::Stub tts(TextToSpeech::NewStub(channel));

ListVoicesRequest voice_request;
ListVoicesResponse voice_response;

grpc::ClientContext tts_context;
grpc::Status rpc_tts_status = tts->
ListVoices(&tts_context, voice_request, &voice_response);
if (!rpc_tts_status.ok()) {
std::cerr << rpc_tts_status.error_message() << rpc_tts_status.error_code() << rpc_tts_status.error_details() <<std::endl;
return -1;
}

return 0;
}

I'm trying to implement Google Text To Speech but I'm receiving this error: GRPC target method can't be resolved.

Any ideas?

Yang Gao

unread,
Jul 31, 2018, 1:01:33 PM7/31/18
to g.bal...@solid55.com, grpc.io
This error is not reported by grpc library but the backend. It is likely you used a wrong endpoint or API version.

I suggest you try texttospeech.googleapis.com and v1beta1 according to the doc page: https://cloud.google.com/text-to-speech/docs/reference/rpc/

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/fc3927a4-42c8-4d82-b2c8-43c4337109d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sas...@gmail.com

unread,
Aug 17, 2018, 6:17:56 AM8/17/18
to grpc.io
I get the same error with v1beta1. Both v1 and v1beta1 give same error. 
Reply all
Reply to author
Forward
0 new messages