KeyValueStoreClient missing dependencies when running locally

  "dependencies": {
"@apollo/client": "3.3.16",
"axios": "0.19.2",
"defender-admin-client": "1.7.0",
"defender-autotask-client": "1.7.0",
"defender-kvstore-client": "1.7.0",
"defender-relay-client": "1.7.0",
"dotenv": "^10.0.0",
"ethers": "5.0.3",
"web3": "1.3.4"
 // Dependencies hardcoded versions taken from openzeppelin docs

const { KeyValueStoreClient } = require('defender-kvstore-client');

(on local)
➜ node index.js
throw err;

Error: Cannot find module ‘aws-sdk/clients/lambda’
Require stack:

  • /Users/relayer/node_modules/defender-base-client/lib/autotask/index.js
  • /Users/relayer/node_modules/defender-kvstore-client/lib/index.js
  • /Users/relayer/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)

Hey @Elyx0! The kvstore-client is only meant to be used from within an Autotask, where the aws-sdk is implicitly available. However, we should make sure it does not fail when imported locally - or at least that we fail with a friendlier message.

In the meantime, you’ll need to avoid the require if you’re running locally. Apologies for the inconvenience!

1 Like