Skip to content

Commit f61fa7b

Browse files
committed
fix build
1 parent e7f67b4 commit f61fa7b

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ dist
1212
# published
1313
index.js
1414
lambda-wrapper.js
15-
handler.cjs
16-
handler.mjs
1715
loader.js
1816
# misc
1917
.DS_Store

src/handler.cjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const { loadSync } = require('./load-sync');
2+
const { wrap } = require('./index');
3+
4+
const actualHandler = process.env.BASELIME_ACTUAL_HANDLER;
5+
const taskRoot = process.env.LAMBDA_TASK_ROOT;
6+
7+
if(!taskRoot) {
8+
throw Error('LAMBDA_TASK_ROOT is not defined');
9+
}
10+
11+
if(!actualHandler) {
12+
throw Error('BASELIME_ACTUAL_HANDLER is not defined');
13+
}
14+
15+
const handler = loadSync(taskRoot, actualHandler);
16+
17+
exports.handler = wrap(handler);

src/handler.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { wrap } from './index';
2+
import { load } from './load-async'
3+
4+
5+
const actualHandler = process.env.BASELIME_ACTUAL_HANDLER;
6+
const taskRoot = process.env.LAMBDA_TASK_ROOT;
7+
8+
if(typeof taskRoot !== 'string') {
9+
throw Error('LAMBDA_TASK_ROOT is not defined');
10+
}
11+
12+
if(typeof actualHandler !== 'string') {
13+
throw Error('BASELIME_ACTUAL_HANDLER is not defined');
14+
}
15+
16+
export const handler = wrap(await load(taskRoot, actualHandler));

0 commit comments

Comments
 (0)