Serverless function builds successfully but crashes when accessed.
The serverless function should execute without running into file descriptor limits.
When visiting the deployed function, the process crashes with the following error logs:
Error: EMFILE: too many open files, open '/var/task/node_modules/@reown/appkit-common/dist/esm/src/utils/DateUtil.js'
at async open (node:internal/fs/promises:638:25)
at async readFile (node:internal/fs/promises:1238:14)
at async getSource (node:internal/modules/esm/load:44:14)
at async defaultLoad (node:internal/modules/esm/load:116:34)
at async ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:479:32) {
errno: -24,
code: 'EMFILE',
syscall: 'open',
path: '/var/task/node_modules/@reown/appkit-common/dist/esm/src/utils/DateUtil.js'
}
Node.js process exited with exit status: 1.
Error: EMFILE: too many open files, open '/var/task/node_modules/viem/_esm/utils/ens/normalize.js'
The error EMFILE: too many open files indicates that the process is exceeding the system’s file descriptor limit. This might be due to:
1. Large dependency size (@reown/appkit-siwe and related packages).
2. Too many file operations happening simultaneously.
3. System-level file descriptor limit (ulimit -n) being too low.
How to fix this?