RJ
RJ2y ago

esbuild failure: No loader is configured for ".node" files

I just added a Node action and tried to deploy it to my dev environment, and observed the following error:
✘ [ERROR] No loader is configured for ".node" files: node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node

node_modules/ssh2/lib/protocol/crypto.js:30:20:
30 │ binding = require('./crypto/build/Release/sshcrypto.node');
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No loader is configured for ".node" files: node_modules/cpu-features/build/Release/cpufeatures.node

node_modules/cpu-features/lib/index.js:3:24:
3 │ const binding = require('../build/Release/cpufeatures.node');
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
✖ esbuild failed: Error: Build failed with 2 errors:
node_modules/cpu-features/lib/index.js:3:24: ERROR: No loader is configured for ".node" files: node_modules/cpu-features/build/Release/cpufeatures.node
node_modules/ssh2/lib/protocol/crypto.js:30:20: ERROR: No loader is configured for ".node" files: node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node
✘ [ERROR] No loader is configured for ".node" files: node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node

node_modules/ssh2/lib/protocol/crypto.js:30:20:
30 │ binding = require('./crypto/build/Release/sshcrypto.node');
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No loader is configured for ".node" files: node_modules/cpu-features/build/Release/cpufeatures.node

node_modules/cpu-features/lib/index.js:3:24:
3 │ const binding = require('../build/Release/cpufeatures.node');
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
✖ esbuild failed: Error: Build failed with 2 errors:
node_modules/cpu-features/lib/index.js:3:24: ERROR: No loader is configured for ".node" files: node_modules/cpu-features/build/Release/cpufeatures.node
node_modules/ssh2/lib/protocol/crypto.js:30:20: ERROR: No loader is configured for ".node" files: node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node
I'm guessing this has something to do with the ssh2-sftp-client package, which I haven't used before and which is a dependency of this particular action.
7 Replies
RJ
RJOP2y ago
bump
ballingt
ballingt2y ago
Convex Node.js actions don't support libraries which require compiling C code to install, in this case cpu-features. We'd like to, we have ideas for this: install npm packages in the runtime environment instead of bundling them.
ballingt
ballingt2y ago
Reading the docs for ssh2, the library requiring cpu-features, it looks like it's supposed to be optional. https://www.npmjs.com/package/ssh2
npm
ssh2
SSH2 client and server modules written in pure JavaScript for node.js. Latest version: 1.14.0, last published: 7 days ago. Start using ssh2 in your project by running npm i ssh2. There are 1327 other projects in the npm registry using ssh2.
ballingt
ballingt2y ago
Ah I see, it's not just cpu-features here but also ssh2 needing sshcrypto.node. Looks like ssh2 can't be used with Convex Node.js actions then, at least for now.
RJ
RJOP2y ago
Does Convex's native runtime support such libraries?
ballingt
ballingt2y ago
No, there's also no compiled C code allowed in the Convex JavaScript runtime. Node.js actions may support this in the future, but the Convex runtime won't unless these are compiled to WebAssembly.
presley
presley17mo ago
UPDATE: We have released a new beta feature in convex 1.4 (https://news.convex.dev/announcing-convex-1-4/) that will allow us to skip bundling and install the packages on the server. We believe this will likely get ssh2 working. More details on how to use the feature https://docs.convex.dev/functions/bundling?ref=news.convex.dev#external-packages.
Convex News
Announcing Convex 1.4
Convex 1.4 introduces a new option to install packages used in your Node action environment on the server, a variety of logging improvements, a new option to pause deployments, a new npm create convex command and more! External packages in Node.js Before 1.4, several NPM dependencies were
Bundling | Convex Developer Hub
Bundling is the process of gathering, optimizing and transpiling the JS/TS

Did you find this page helpful?