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?

已提問 1 年前檢視次數 318 次
1 個回答
0

No it is same.

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南