ghdna / athena-express

Athena-Express can simplify executing SQL queries in Amazon Athena AND fetching cleaned-up JSON results in the same synchronous or asynchronous request - well suited for web applications.
https://www.npmjs.com/package/athena-express
MIT License
181 stars 70 forks source link

"UnexpectedParameter: Unexpected key 'Catalog' found in params.QueryExecutionContext" #82

Open aaaferns opened 2 years ago

aaaferns commented 2 years ago

I am getting this error message when I submit a query. "UnexpectedParameter: Unexpected key 'Catalog' found in params.QueryExecutionContext" Followed the instructions as per ReadMe. I am not suppling this parameter at all. this is my config. const athenaExpressConfig = { aws: AWS, s3: s3://${process.env.ENV_ATHENA_S3BUCKET}, }; Query { "query": "select datapointid, journeyid, capturedtimestamp, location from vehicle_movements_daily LIMIT 100", "db": "vm_db" } First I thought that it was a configuration or IAM role issue and therefore I tried using athenaClient and I was able to get results without issue( only timeout issue which is expected).

AreebWaseem commented 2 years ago

I am experiencing the same issue on v7.1

ghdna commented 2 years ago

can you provide more steps for me to replicate this issue?

AreebWaseem commented 2 years ago

I have written an aws lambda node js script:

` const AthenaExpress = require("athena-express"), aws = require("aws-sdk");

const athenaExpressConfig = { aws, db: "db", getStats: true };

const athenaExpress = new AthenaExpress(athenaExpressConfig);

exports.handler = async (event, context, callback) => { const sqlQuery = 'SELECT * FROM "tags"';

try {
    let results = await athenaExpress.query(sqlQuery);
    callback(null, results);
} catch (error) {
    callback(error, null);
}

}; `

AreebWaseem commented 2 years ago

Seems like removing Catalog from this function removes the issue:

  const params = {
    QueryString: config.sql,
    WorkGroup: config.workgroup,
    ResultConfiguration: {
      OutputLocation: config.s3Bucket,
    },
    QueryExecutionContext: {
      Database: config.db,
      Catalog: config.catalog,
    },
  };