I have created a lambda function to query my s3 data using Athena but getting 500 error.

0

Hello Developers, I have created a lambda function to query my S3 data using Athena and it is working locally fine but once I pushed it to production I am getting the following error.

{ "responseCode": 500, "responseMessage": "Internal server error", "response": { "errors": [ { "errorCode": "UNCAUGHT", "errorTitle": "We seems to have a problem!", "errorDescription": "Our internal system is having problem, please contact our administrator!", "errorDebugDescription": "Query has not yet finished. Current state: QUEUED", "errorAttributes": [] } ] } }

What I did in my code is as follows:

    const queryExecution = {
      QueryString: `SELECT event_target,count(*) as count FROM ${dbAndTable} WHERE room_id = '${storeId}' GROUP BY event_target ORDER BY count(*) DESC LIMIT ${faqSqlLimit}`,
      ResultConfiguration: {
        OutputLocation: s3Location
      }
    };

   const queryExecutionResult = await client.startQueryExecution(queryExecution).promise();
    await checkIsAthenaExecutionRunning(queryExecutionResult.QueryExecutionId);
    const athenaResponse = await client
      .getQueryResults({ QueryExecutionId: queryExecutionResult.QueryExecutionId })
      .promise();

    if (!athenaResponse.ResultSet.Rows[1]) {
      throw APIError.notFound();
    }

    const results = formatAthenaResult(athenaResponse);

const checkIsAthenaExecutionRunning = async (id) => {
  const params = {
    QueryExecutionId: id
  };
  const data = await client.getQueryExecution(params).promise();

  if (data.QueryExecution.Status.State && data.QueryExecution.Status.State === 'RUNNING') {
    return checkIsAthenaExecutionRunning(id);
  }
  return data;
};

Everything is working fine on my local machine but once I pushed my code to AWS It is now working and getting the above error. Any advice?

gefragt vor einem Jahr318 Aufrufe
1 Antwort
0

No it is same.

beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen