Problem using Aws::LexRuntimeV2::LexRuntimeV2Client – RecognizeText in QT / C++

  amazon-lex, amazon-web-services, c++, sdk

Hi,
I am using QT 5 (C++) to integrate our application with our amazon Lex chatBot. I am using AWS SDK C++.
I have problems using function RecognizeText.
My code is;

Aws::SDKOptions options;

options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;

Aws::InitAPI(options);

{

m_lexRuntime = new Aws::LexRuntimeV2::LexRuntimeV2Client; // credentials and config setted in file

Aws::LexRuntimeV2::Model::RecognizeTextRequest request;

request.SetBotId("MYBOTID");

request.SetBotAliasId("MYALIASBOTID");

request.SetLocaleId("es_ES");

request.SetSessionId("TEST");

request.SetText("Test text");

const Aws::LexRuntimeV2::Model::RecognizeTextOutcome output_lex = m_lexRuntime->RecognizeText(request);

qDebug() << "Tamanyo " << output_lex.GetResult().GetMessages().size();

if (output_lex.GetResult().GetMessages().size() > 0)

qDebug() << "DATA " << QString::fromLatin1(output_lex.GetResult().GetMessages().at(0).GetContent().data());

}

Aws::ShutdownAPI(options);

When I launch the program normally, the variable output_lex is empty, BUT THE REQUEST IS OK;

[TRACE] 2021-10-05 13:14:26.444 CurlHttpClient [140737127642880] 733 bytes written to response.
[DEBUG] 2021-10-05 13:14:26.444 CURL [140737127642880] (SSLDataIn) 5bytes
[DEBUG] 2021-10-05 13:14:26.444 CURL [140737127642880] (Text) Connection #0 to host runtime-v2-lex.eu-west-1.amazonaws.com left intact

[DEBUG] 2021-10-05 13:14:26.444 CurlHttpClient [140737127642880] Returned http response code 200

[DEBUG] 2021-10-05 13:14:26.444 CurlHttpClient [140737127642880] Returned content type application/json

[TRACE] 2021-10-05 13:14:26.444 CurlHttpClient [140737127642880] Response content-length header: 733

[TRACE] 2021-10-05 13:14:26.444 CurlHttpClient [140737127642880] Response body length: 733

[DEBUG] 2021-10-05 13:14:26.444 CurlHttpClient [140737127642880] Releasing curl handle 0x7fffe00dab40

[DEBUG] 2021-10-05 13:14:26.444 CurlHandleContainer [140737127642880] Releasing curl handle 0x7fffe00dab40

[DEBUG] 2021-10-05 13:14:26.444 CurlHandleContainer [140737127642880] Notified waiting threads.

[DEBUG] 2021-10-05 13:14:26.444 AWSClient [140737127642880] Request returned successful response.

[TRACE] 2021-10-05 13:14:26.444 AWSClient [140737127642880] Request successful returning.

When I launch the program WITH GDB, the variable output_lex is FILLED CORRECTLY (I have messages and intentions filled), WITH THE SAME OUTPUT
IN LOG THAN BEFORE.
¿Anyone knows what could be happening? ¿Why the program works on GDB-LAUNCHING but not in normal mode?

Source: Windows Questions C++

LEAVE A COMMENT