nodeJS 애플리케이션
"use strict";
const express = require('express');
const app = express();
require('dotenv').config();
const AthenaExpress = require("athena-express"),
AWS = require("aws-sdk"),
awsCredentials = {
region: process.env.AWS_REGION,
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
};
AWS.config.update(awsCredentials);
const athenaExpressConfig = {
aws: AWS,
s3: process.env.S3_URI,
getStats: true
};
const athenaExpress = new AthenaExpress(athenaExpressConfig);
//Invoking a query on Amazon Athena
app.get('/all', (req, res) =>{
(async () => {
let getAllQuery = {
sql: "SELECT * FROM myapp_cf_access_logs_db.combined limit 2",
db: "myapp_cf_access_logs_db"
};
try {
let results = await athenaExpress.query(getAllQuery);
res.send(JSON.stringify(results)).status(200)
} catch (error) {
console.log(error);
}
})();
})
app.listen(3000, () => {
console.log(`Example app listening on port 3000`)
})
무한 로딩에러? 발생!
TypeError: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
at /Users/masonjar/express-athena/index.js:36:27
at processTicksAndRejections (node:internal/process/task_queues:96:5)
^C%