By using AWS re:Post, you agree to the AWS re:Post Terms of Use

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?

asked 2 years ago480 views
1 Answer
0

No it is same.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions