Skip to content

Commit

Permalink
debug lambda statusCode
Browse files Browse the repository at this point in the history
  • Loading branch information
schehata committed Jul 26, 2022
1 parent 6a47b5b commit 52cf53d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/withAxiom.ts
Expand Up @@ -98,14 +98,16 @@ export type AxiomApiHandler = (
) => NextApiHandler | Promise<NextApiHandler> | Promise<void>;

function withAxiomNextApiHandler(handler: NextApiHandler): NextApiHandler {
console.log('this is a lambda api endpoint')
return async (req, res) => {
const report: RequestReport = {
startTime: new Date().getTime(),
path: req.url!,
method: req.method!,
host: req.headers['host'] || '',
scheme: req.headers['host']?.split('://')[0] || '',
ip: '',
userAgent: req.headers['user-agent'] || '',
scheme: 'https',
ip: req.headers['X-Forwarded-For']? req.headers['X-Forwarded-For'][0] : '',
region: '',
};
const logger = new Logger({}, report, false);
Expand Down

0 comments on commit 52cf53d

Please sign in to comment.