athena-express
athena-express copied to clipboard
Empty response when using pagination
Hi, I ran into an unexpected situation using pagination parameter.
The queries where I use pagination parameter sometimes return with an empty response. But if I run the same query on AWS console, there are results. The S3 file also has the correct response, but the library says otherwise.
If I take out the pagination parameter this problem never happens. But the case is that I have a query with many results, so I need to use the pagination.
Anyone has the same problem? Is there a solution for this?
Thanks!
I was experiencing it too. What I think is happening is that the previous query/pagination is cached somehow between runs so when you have run through all the results you get empty results every query afterwards.
I'm running it in a lambda and a workaround that I found that fixed it was moving the initialization to inside the exports.handler like this
"use strict";
const AthenaExpress = require("athena-express");
const AWS = require("aws-sdk");
exports.handler = async (event) => {
const athenaExpressConfig = {
aws: AWS,
};
const athenaExpress = new AthenaExpress(athenaExpressConfig);
...
Pushed a new version on NPM. Give this one a try please.