databricks-sql-nodejs
databricks-sql-nodejs copied to clipboard
lz4 module causes Azure Function App to fail
I know others have reported issues with the lz4 module as well. In my case, it's only an issue when I deploy my app as an Azure Function.
Result: Failure Exception: Worker was unable to load function clinical: 'Module did not self-register: '/home/site/wwwroot/node_modules/lz4/build/Release/xxhash.node'.' Stack: Error: Worker was unable to load function clinical: 'Module did not self-register: '/home/site/wwwroot/node_modules/lz4/build/Release/xxhash.node'.' at Module._extensions..node (node:internal/modules/cjs/loader:1460:18) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at Object.apply (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:51713) at Module.patchedRequire (/home/site/wwwroot/node_modules/diagnostic-channel/dist/src/patchRequire.js:16:46) at Module.patchedRequire (/home/site/wwwroot/node_modules/require-in-the-middle/index.js:246:27) at Hook._require.Module.require (/home/site/wwwroot/node_modules/require-in-the-middle/index.js:171:27) at require (node:internal/modules/helpers:177:18) at Object.<anonymous> (/home/site/wwwroot/node_modules/lz4/lib/utils.js:4:11)
Basically the failure is "Module did not self-register", which I guess this code misses in the exception handler:
https://github.com/databricks/databricks-sql-nodejs/blob/56bd0d90d61a2bdff4e62cd55ebcb8d070fa60e2/lib/utils/lz4.ts#L1-L16
I was able to work around this by removing the lz4 optional dependency and lz4 entry manually from my package-lock.json file, which of course is not ideal.