epsagon/serverless-plugin-epsagon

TypeScript handler looks like ES5

juanjoDiaz opened this issue · 1 comments

Instead of

var epsagon = require('epsagon');
var handler = require('../RELATIVE_PATH');

epsagon.init({
    token: 'TOKEN',
    appName: 'APP_NAME',
    collectorURL: COLLECTOR_URL,
    metadataOnly: Boolean(METADATA_ONLY)
});

exports.METHOD = epsagon.WRAPPER_TYPE(handler.METHOD);

I would have expected

import * as epsagon from 'epsagon';
import { METHOD as origMethod } as handler from '../RELATIVE_PATH';

epsagon.init({
    token: 'TOKEN',
    appName: 'APP_NAME',
    collectorURL: COLLECTOR_URL,
    metadataOnly: Boolean(METADATA_ONLY)
});

exports const METHOD = epsagon.WRAPPER_TYPE(origMethod);

Hi, this really depends on the version of Lambda, and the compilation of the user. It might be nice to implement but needs to be thoroughly tested - if you want to.