Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Cannot find module '/var/task/thread.js'" in AWS Lambda #15

Open
tonisives opened this issue Jan 18, 2024 · 0 comments
Open

"Cannot find module '/var/task/thread.js'" in AWS Lambda #15

tonisives opened this issue Jan 18, 2024 · 0 comments

Comments

@tonisives
Copy link

Weird error happens in AWS Lambda environment only. It works locally.

I am using solidity-code-metrics in my project. If I include the const surya = require('surya');, then the lambda fails with this uncaught exception. It isn’t even caught my try {} catch block. So this isn’t a normal crash

If I remove the surya import, then the the lambda manages to finish.

https://github.com/tonisives/solidity-metrics/blob/master/src/metrics/metrics.js#L17

Error with surya import enabled

2024-01-18T07:26:34 2024-01-18T07:26:34.870Z    346d3c3a-3183-44b4-ad82-2d4b0b6b96bf    INFO    metrics 35. Storing metrics                                   
2024-01-18T07:26:35 2024-01-18T07:26:35.151Z    346d3c3a-3183-44b4-ad82-2d4b0b6b96bf    ERROR   Uncaught Exception      {"errorType":"Error",
"errorMessage":"Cannot find module '/var/task/thread.js'",
"code":"MODULE_NOT_FOUND",
"requireStack":[],
"stack":
["Error: Cannot find module '/var/task/thread.js'","    
   at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)","   
   at Module._load (node:internal/modules/cjs/loader:985:27)","    
   at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)"," 
   at MessagePort.<anonymous> (node:internal/main/worker_thread:185:26)","    
   at [nodejs.internal.kHybridDispatch] (node:internal/event_target:814:20)","   
   at exports.emitMessage (node:internal/per_context/messageport:23:28)"]}
2024-01-18T07:26:35 Unknown application error occurred
Runtime.Unknown                                                                                                                                               
2024-01-18T07:26:35 END RequestId: 346d3c3a-3183-44b4-ad82-2d4b0b6b96bf

Please note I have made some patches to get SCM working in Lambda. But this one seems to be a new one from changes from max 1 year ago.

I tried surya 0.4.6 and also an update to 0.4.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant