```Unhandled Promise Rejection {"errorType":"R...
# help
m
Copy code
Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read property 'filename' of undefined","reason":"TypeError: Cannot read property 'filename' of undefined","promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read property 'filename' of undefined","    at process.<anonymous> (file:///D:/Starlight/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (events.js:400:28)","    at processPromiseRejections (internal/process/promises.js:245:33)","    at processTicksAndRejections (internal/process/task_queues.js:96:32)"]}
I am getting this error using appsync construct and its related to datasource of handler on windows kindly help me in resolving this
f
Hey @Muhammad Ahsan Khan, i’m looking into this issue right now. I will keep you posted.
Definitely seems to be a windows issue.
m
ok thanks @Frank
f
Leaving a note here.. following up with @Muhammad Ahsan Khan in DM.
d
I'm getting the same error on Mac trying to run live debug for the first time. Everything deploys but when I refresh my app the API calls cause this error. I am not using appsync, just API Gateway
Copy code
Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read properties of undefined (reading 'filename')","reason":"TypeError: Cannot read properties of undefined (reading 'filename')","promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read properties of undefined (reading 'filename')","    at process.<anonymous> (file:///Users/dan/projects/savvy-trader/savvy-trader-backend/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (node:events:390:28)","    at emit (node:internal/process/promises:136:22)","    at processPromiseRejections (node:internal/process/promises:242:25)","    at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
j
Just following up on this, @Dan Suceava are you still having this issue?
d
yes, still do
j
Let me bring it to @Frank’s attention.
Just talked to @Frank, he said he has a repo and he’s going to try and reproduce this.
d
awesome, thanks for the help
f
I managed to reproduce this issue on my end. I should have a fix real soon.
j
Hey @Frank do you have an eta for this fix?
Or is there a version I can downgrade to so I can be unblocked?
f
Hey @jamlen I should have something soon. Working on a fix right now.
Btw, do you think you can provide me with a stripped down version of ur SST app where I can give a try on my end to reproduce the issue?
j
@Frank yep I’ll push the repo up soon.
f
Thanks @jamlen that’d be super helpful 🙏
@jamlen r u using typeorm by any chance? Ah noticed from ur the other thread that you are using TypeORM. Can you try the solution below and let me know if it works for you?
@Muhammad Ahsan Khan can you try adding this at the beginning of the
main
function inside ur
stacks/index.ts
Copy code
app.setDefaultFunctionProps({
  bundle: {
    nodeModules: ["typeorm"],
  },
});
The error comes from this app-root-path library that TypeORM uses. And it doesn’t seem to be compatible with
esbuild
.
Give it a try and let me know if it works for you.
d
@Frank that fixed it for me, thanks for that update
m
Thanks @Frank, This solution resolve the problem.