arabold / serverless-sentry-lib

MIT License
32 stars 15 forks source link

Cannot read property 'bind' of undefined #15

Closed JohannesHome closed 4 years ago

JohannesHome commented 5 years ago

The sentry lib binds to the old callbacks provided through the context

These callbacks do not exist in my lambda Environment and they don't seem to be documented.

Stack trace of the error:

TypeError: Cannot read property 'bind' of undefined { error:
   TypeError: Cannot read property 'bind' of undefined
       at /var/task/src/webpack:/node_modules/serverless-sentry-lib/src/index.js:315:1
       ...
StephanBijzitter commented 5 years ago

Same issue, slightly different message:

            const originalCallbacks = {
                done: context.done.bind(context), // context is undefined
                succeed: context.succeed.bind(context),
                fail: context.fail.bind(context),
                callback: callback,
            };
2019-06-04T22:57:11.485Z    bf16a167-5120-4089-8212-3feb3615a9ee    TypeError: Cannot read property 'done' of undefined
at Object.master (/var/task/node_modules/serverless-sentry-lib/src/index.js:315:19)
at exports.handler (/var/src/handler.ts:8:23)
at invoke (/var/runtime/node_modules/awslambda/index.js:288:20)
at InvokeManager.start (/var/runtime/node_modules/awslambda/index.js:151:9)
at Object.awslambda.waitForInvoke (/var/runtime/node_modules/awslambda/index.js:499:52)
import * as RavenLambdaWrapper from 'serverless-sentry-lib';
import Raven from 'raven';

export const master = RavenLambdaWrapper.handler(Raven, async (event) => {
    // code redacted, don't think it's important plus it's quite a lot

    return {
        statusCode: 200,
        body: JSON.stringify({
            ...result,
            master: {
                duration
            }
        })
    };
});
arabold commented 4 years ago

Will be fixed in next update