BUG: Application crash when built with TypeScript
The debug block code in index.js is crashing the application in runtime with the following error:
Error: ENOENT: no such file or directory, open './test/data/05-versions-space.pdf'
at Object.openSync (fs.js:457:3)
at Object.readFileSync (fs.js:359:35)
at Object.<anonymous> (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/webpack:/node_modules/pdf-parse/index.js:16:1)
at Object../node_modules/pdf-parse/index.js (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/handler.js:66824:30)
at __webpack_require__ (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/webpack:/webpack/bootstrap:25:1)
at Module../parser.ts (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/webpack:/parser.ts:1:1)
at __webpack_require__ (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/webpack:/webpack/bootstrap:25:1)
at Module../crew-link.ts (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/webpack:/crew-link.ts:1:1)
at __webpack_require__ (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/webpack:/webpack/bootstrap:25:1)
at Module../handler.ts (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/webpack:/handler.ts:2:1)
at __webpack_require__ (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/webpack:/webpack/bootstrap:25:1)
at /Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/webpack:/webpack/bootstrap:116:1
at Object.<anonymous> (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/.webpack/service/handler.js:120:10)
at Module._compile (internal/modules/cjs/loader.js:1144:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
at Module.load (internal/modules/cjs/loader.js:993:32)
at Function.Module._load (internal/modules/cjs/loader.js:892:14)
at Module.require (internal/modules/cjs/loader.js:1033:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.createHandler (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/node_modules/serverless-offline/src/functionHelper.js:215:15)
at handler (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/node_modules/serverless-offline/src/ApiGateway.js:485:40)
at module.exports.internals.Manager.execute (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/node_modules/@hapi/hapi/lib/toolkit.js:41:33)
at Object.internals.handler (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/node_modules/@hapi/hapi/lib/handler.js:46:48)
at exports.execute (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/node_modules/@hapi/hapi/lib/handler.js:31:36)
at Request._lifecycle (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/node_modules/@hapi/hapi/lib/request.js:312:68)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Request._execute (/Users/betorcs/Projects/icrew-sls-gol/aws-lambda/node_modules/@hapi/hapi/lib/request.js:221:9) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: './test/data/05-versions-space.pdf'
}