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

Bug Report: Error [ERR_MODULE_NOT_FOUND] in @celo/identity Library #281

Open
JovanMwesigwa opened this issue May 27, 2024 · 0 comments
Open

Comments

@JovanMwesigwa
Copy link

Expected Behavior

I expect the modules from the @celo/identity library to be imported without errors, allowing for successful execution of the code. Specifically, I expect the following imports to work correctly:

import { OdisUtils } from "@celo/identity";
import {
  AuthSigner,
  OdisContextName,
  ServiceContext,
} from "@celo/identity/lib/odis/query";

Current Behavior

The current behavior results in an Error [ERR_MODULE_NOT_FOUND] during the importation of specific modules from the @celo/identity library. The error message is as follows:

node:internal/process/esm_loader:97
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/jovan/dev/bwc-celo-hackathon/social-connect/node_modules/@celo/identity/lib/odis/query' imported from /Users/jovan/dev/bwc-celo-hackathon/social-connect/index.js
Did you mean to import @[email protected]/node_modules/@celo/identity/lib/odis/query.js?
    at new NodeError (node:internal/errors:405:5)
    at finalizeResolution (node:internal/modules/esm/resolve:324:11)
    at moduleResolve (node:internal/modules/esm/resolve:943:10)
    at defaultResolve (node:internal/modules/esm/resolve:1129:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Additional Information

Here is the relevant code snippet causing the issue:

import { newKit } from "@celo/contractkit";
import { OdisUtils } from "@celo/identity";
import {
  AuthSigner,
  OdisContextName,
  ServiceContext,
} from "@celo/identity/lib/odis/query";

import { config } from "dotenv";

config();

// Replace this with your actual private key
let ISSUER_PRIVATE_KEY = process.env.ISSUER_PRIVATE_KEY;

const kit = new newKit("https://alfajores-forno.celo-testnet.org");
kit.addAccount(ISSUER_PRIVATE_KEY);

const issuerAddress =
  kit.web3.eth.accounts.privateKeyToAccount(ISSUER_PRIVATE_KEY).address;
kit.defaultAccount = issuerAddress;

console.log(`Issuer Address: ${issuerAddress}`);

const userPlainIdentifier = process.env.USER_PHONE;
const userAddress = process.env.USER_ADDRESS;

const authSigner = {
  authenticationMethod: OdisUtils.Query.AuthenticationMethod.WALLET_KEY,
  contractKit: kit,
};
// Record the time when the verification is completed
const attestationVerifiedTime = Date.now();

// Register the user's phone number
const registerPhone = async () => {};

const checkQuota = async () => {
  //   serviceContext provides the ODIS endpoint and public key
  const serviceContext = OdisUtils.Query.getServiceContext(
    OdisContextName.ALFAJORES
  );

  const { remainingQuota } = await OdisUtils.Quota.getPnpQuotaStatus(
    issuerAddress,
    authSigner,
    serviceContext
  );

  console.log("====================================");
  console.log("Remaining Quota: ", remainingQuota);
  console.log("====================================");
};

checkQuota();

Environment

I have followed the documentation precisely, but the issue persists. Any guidance or fix for this problem would be greatly appreciated.

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