Hi There,
I have using the Serverless application for my Node Application. I have my specific serverless.yml file and i used layers concept to pack my dependency.
I have my all basic modules code in serverHandler Lambda function. That function contains many HTTP calls(API gateway), Like wise i have implemented the jsreport tool in my application.
I have implemented the jsreport logic with necessary package and logic in my Class object and exported properly and i have used that object function in my one of end point (/invoice-generate) this is comes under the serverHandler lambda.
When i try run my application in my local that perfectly working and jsreport provides the proper Output.
Problem is When i deploy the code on aws lambda my whole app gets crash and throws below error:
This error captured in CloudWatch.
**ERROR Uncaught Exception
{
"errorType": "TypeError",
"errorMessage": "Cannot read properties of undefined (reading 'filename')",
"stack": [
"TypeError: Cannot read properties of undefined (reading 'filename')",
" at resolve (/var/task/dist/index.js:394335:50)",
" at module2.exports (/var/task/dist/index.js:394352:25)",
" at node_modules/app-root-path/index.js (/var/task/dist/index.js:394379:23)",
" at __require (/var/task/dist/index.js:13:50)",
" at node_modules/jsreport-core/lib/reporter.js (/var/task/dist/index.js:394634:19)",
" at __require (/var/task/dist/index.js:13:50)",
" at node_modules/jsreport-core/index.js (/var/task/dist/index.js:398812:20)",
" at __require (/var/task/dist/index.js:13:50)",
" at dist/src/lib/download_service.js (/var/task/dist/index.js:573617:20)",
" at __require (/var/task/dist/index.js:13:50)",
" at dist/src/chargingSessions/invoices.js (/var/task/dist/index.js:573710:30)",
" at __require (/var/task/dist/index.js:13:50)",
" at dist/src/chargingSessions/router.js (/var/task/dist/index.js:573848:22)",
" at __require (/var/task/dist/index.js:13:50)",
" at dist/src/setupRoute.js (/var/task/dist/index.js:621827:21)",
" at __require (/var/task/dist/index.js:13:50)",
" at Object. (/var/task/dist/index.js:622691:20)",
" at Module._compile (node:internal/modules/cjs/loader:1198:14)",
" at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)",
" at Module.load (node:internal/modules/cjs/loader:1076:32)",
" at Function.Module._load (node:internal/modules/cjs/loader:911:12)",
" at Module.require (node:internal/modules/cjs/loader:1100:19)"
] **
Even i have download the lambda function from s3, There is no line available which is given by the cloud watch logs.
Im not sure what is the root cause of this. I have tried for last 5 days to find out the root cause. But i could not. Im confusing why not working in AWS lambda but working in my machine.
Folks/techees Please help me to get this things sort out.
Im in a situation that i need to fix this ASAP.
Please let me know if you need more details about my Code structure. Im happy to share the details.