AnomalyInnovations / serverless-bundle

Optimized packages for ES6 and TypeScript Node.js Lambda functions without any configuration.
https://serverless-stack.com/chapters/package-lambdas-with-serverless-bundle.html
MIT License
536 stars 157 forks source link

DEBUG error while getting callsite source context: ENOENT: no such file or directory #114

Open VED-StuartMorris opened 4 years ago

VED-StuartMorris commented 4 years ago

Wondering if someone could point me in the right direction on this. I have a fairly simple testing function setup using serverless-bundle in which I am receiving a bunch of messages in cloudwatch when it is run.

Screenshot 2020-07-18 at 13 21 33

Example

2020-07-18T12:12:05.926Z    4423b254-bc6b-4399-85af-5f14fd21ea68    DEBUG   error while getting callsite source context: ENOENT: no such file or directory, open '/var/task/src/functions/webpack:/Users/localuser/[LOCAL PATH]/src/functions/orderHistory.js'

It seems to be referring to the [LOCAL PATH] (removed/cleaned for this issue) within the error/message.

Function example:

const handlerFunc = async (event, context) => {
  context.callbackWaitsForEmptyEventLoop = false;
  try {
    if (pool === null) {
      pool = await sql.connect(config);
    }

    console.log("throwing from try");
    throw new CreateError(400, "user id error");
  } catch (err) {
    // Capture Error in Serverless, will also console.error the err object
    context.serverlessSdk.captureError(err);

    console.log("throwing from catch");
    throw new CreateError.UnprocessableEntity();
  }
};
export const handler = middy(handlerFunc).use(cors()).use(httpErrorHandler());
VED-StuartMorris commented 4 years ago

This seems to come up when I have the following serverless configuration

package:
    individually: true

-- and using the default bundle / sourcemaps true.

jayair commented 4 years ago

Hmmm can you create a test repo with the issue? It looks like some files aren't getting included correctly?

luddilo commented 2 years ago

@VED-StuartMorris did you solve this somehow? Experiencing the same

JerryAgbesi commented 1 year ago

@VED-StuartMorris has this been solved yet?