LearnCard Documentation
GithubStatusSupportLaunch App
  • 🚀Introduction
    • What is LearnCard?
    • Use Cases & Possibilities
    • Ecosystem Architecture
  • ⚡Quick Start
    • Setup & Prerequisites
    • Your First Integration
  • 📚Tutorials
    • Create a Credential
    • Create a Boost
    • Create a ConsentFlow
    • Create a Connected Website
    • Send xAPI Statements
    • Listen to Webhooks
  • ✅How-To Guides
    • Verify My Issuer
    • Connect Systems
      • Connect a Website
      • Connect a Game
    • Implement Flows
      • Claim Data after Guardian Consent
      • Connect via CHAPI
        • ⭐CHAPI Wallet Setup Guide
        • ↔️Translating to CHAPI documentation
        • 🖥️Demo Application
        • 🔰Using LearnCard to Interact with a CHAPI Wallet
        • 📝Cheat Sheets
          • Issuers
          • Wallets
    • Deploy Infrastructure
      • Remote Key Management
      • Generate API Tokens
      • Signing Authority
      • Connect to Independent Network
      • Build a Plugin
  • 🛠️SDKs & API Reference
    • LearnCard Wallet SDK
      • Authentication
      • Usage Examples
      • SDK Reference
      • Plugin API Reference
      • Integration Strategies
      • Deployment
      • Troubleshooting
      • Changelog
    • LearnCloud Network API
      • Authentication
      • Usage Examples
      • Architecture
      • Notifications & Webhooks
      • Profiles
      • Profile Managers
      • Credentials
      • Boosts
      • Presentations
      • Storage
      • Contracts
      • DID Metadata
      • Claim Hooks
      • Auth Grants
      • Utilities
      • Models
      • OpenAPI
    • LearnCloud Storage API
      • Authentication
      • Usage Examples
      • Architecture
      • Storage
      • Index
      • User
      • Custom Storage
      • Utilities
      • Models
      • xAPI Reference
    • Plugins
      • Crypto
      • DIDKit
      • DID Key
      • Dynamic Loader
      • VC
        • Expiration Sub-Plugin
      • VC-Templates
      • VC-API
      • Ceramic
      • IDX
      • VPQR
      • Ethereum
      • CHAPI
      • LearnCard Network
      • LearnCloud
      • LearnCard
      • Simple Signing
      • Claimable Boosts
    • LearnCard CLI
  • 🧠Core Concepts
    • Identities & Keys
      • Decentralized Identifiers (DIDs)
      • Seed Phrases
      • Network Profiles
      • Signing Authorities
      • Trust Registries
    • Credentials & Data
      • Verifiable Credentials (VCs)
      • Credential Lifecycle
      • Schemas, Types, & Categories
      • Building Verifiable Credentials
      • Boost Credentials
      • Getting Started with Boosts
      • Credential URIs
      • xAPI Data
      • General Best Practices & Troubleshooting
    • Consent & Permissions
      • ConsentFlow Overview
      • Consent Contracts
      • User Consent & Terms
      • Consent Transactions
      • Auto-Boosts
      • Writing Consented Data
      • Accessing Consented Data
      • GameFlow Overview
    • Network & Interactions
      • Network Vision & Principles
      • Key Network Procedures
      • Core Interaction Workflows
    • Architecture & Principles
      • Control Planes
      • Plugin System
      • Auth Grants and API Tokens
  • 🔗Development
    • Contributing
Powered by GitBook
On this page
  • Installation and Setup Issues
  • Module Resolution Errors
  • WASM Loading Issues
  • Credential Issuance and Verification Issues
  • Invalid Signature Errors
  • DID Resolution Failures
  • Storage and Retrieval Issues
  • URI Resolution Failures
  • Index Retrieval Issues
  • Plugin-Related Issues
  • Plugin Not Found
  • Plugin Method Errors
  • Browser/Environment-Specific Issues
  • CORS Issues
  • Mobile Web View Incompatibilities
  • Debugging Techniques
  • Enable Verbose Logging
  • Inspect Credential Structure
  • Getting Help

Was this helpful?

  1. SDKs & API Reference
  2. LearnCard Wallet SDK

Troubleshooting

Common issues and solutions when working with LearnCard SDK

This guide addresses common issues encountered when developing with LearnCard SDK and provides practical solutions and workarounds.

Installation and Setup Issues

Module Resolution Errors

Issue: Errors like Cannot find module '@learncard/core' or Cannot find module '@learncard/init'

Solutions:

  1. Verify package installation:

    npm list @learncard/core @learncard/init
    # or for pnpm
    pnpm list @learncard/core @learncard/init
  2. Check for version mismatches between LearnCard packages:

    npm list | grep learncard
    # or for pnpm
    pnpm list | grep learncard
  3. Clear node_modules and reinstall:

    rm -rf node_modules
    pnpm install

WASM Loading Issues

Issue: Errors related to WASM loading, particularly in browsers or serverless environments

Error messages:

  • WebAssembly module is included in initial chunk

  • Error: Unable to load WASM module

Solutions:

  1. For webpack, ensure proper WASM loading configuration:

    // webpack.config.js
    module.exports = {
      experiments: {
        asyncWebAssembly: true,
      },
      // ...
    };
  2. For Next.js, use dynamic imports:

    const initializeLearnCard = async () => {
      const { initLearnCard } = await import('@learncard/init');
      return initLearnCard({ seed: yourSeed });
    };
  3. Provide your own WASM bundle path:

    import { initLearnCard } from '@learncard/init';
    import didkitPath from '@learncard/didkit-plugin/dist/didkit/didkit_wasm_bg.wasm?url';
    
    const learnCard = await initLearnCard({ 
      seed: yourSeed,
      didkit: didkitPath
    });

Credential Issuance and Verification Issues

Invalid Signature Errors

Issue: Verification equation was not satisfied or Signature error during credential verification

Solutions:

  1. Ensure you're using the same wallet instance for verification that was used for issuance

  2. Check for credential tampering or modification after issuance

  3. Verify the credential format matches expected schema

  4. Check if the credential has been properly signed:

    // Verify the credential structure
    console.log(JSON.stringify(credential, null, 2));
    
    // Ensure the proof exists and is properly formatted
    console.log(credential.proof);

DID Resolution Failures

Issue: Errors like Unable to resolve DID or Not a valid DID during verification

Solutions:

  1. Verify the DID format:

    // Should follow the pattern: did:method:identifier
    console.log(credential.issuer);
  2. Check network connectivity if resolving remote DIDs

  3. For did:web, ensure the domain is accessible and properly configured

  4. Try resolving the DID manually:

    const didDocument = await learnCard.invoke.resolveDid(credential.issuer);
    console.log(didDocument);

Storage and Retrieval Issues

URI Resolution Failures

Issue: Unable to retrieve credentials from URIs, getting null or errors

Solutions:

  1. Check URI format:

    // Should follow proper URI format for the storage method
    console.log(uri);
  2. Verify network connectivity for remote storage

  3. Ensure the credential exists at the specified location

  4. For LearnCloud storage, check API connectivity:

    const status = await fetch('https://network.learncard.com/health');
    console.log(await status.json());

Index Retrieval Issues

Issue: index.[provider].get() returns empty array or missing credentials

Solutions:

  1. Verify credentials were properly added to the index:

    // Check all indexes
    const allIndexes = await learnCard.index.all.get();
    console.log(allIndexes);
    
    // Check specific index
    const learnCloudIndex = await learnCard.index.LearnCloud.get();
    console.log(learnCloudIndex);
  2. Ensure you're using the same wallet instance (same seed) that added the credentials

  3. Check if the storage service is accessible

Plugin-Related Issues

Plugin Not Found

Issue: Errors like Cannot invoke method from undefined plugin: [methodName]

Solutions:

  1. Ensure plugin is properly registered:

    // Check registered plugins
    console.log(learnCard.plugins.map(p => p.name));
  2. Check plugin initialization order (dependency plugins should be loaded first)

  3. Verify plugin compatibility with your LearnCard Core version

Plugin Method Errors

Issue: Unexpected errors when calling plugin methods

Solutions:

  1. Check method parameters match expected types

  2. Verify plugin version compatibility with core

  3. Enable debug mode if available:

    const learnCard = await initLearnCard({
      seed: yourSeed,
      debug: true
    });

Browser/Environment-Specific Issues

CORS Issues

Issue: CORS errors when accessing storage or DIDs in browser environments

Solutions:

  1. Ensure your backend properly sets CORS headers

  2. For development, consider using a CORS proxy

  3. For Ceramic/LearnCloud, check endpoint configurations

Mobile Web View Incompatibilities

Issue: LearnCard functionality not working in mobile web views

Solutions:

  1. Ensure WASM is supported in the web view

  2. Check for any mobile-specific storage limitations

  3. Consider using LearnCard Bridge HTTP API for mobile apps

Debugging Techniques

Enable Verbose Logging

Add a logging plugin to capture detailed information:

const loggingPlugin = {
  name: 'debug-logger',
  methods: {
    intercept: async (method, params, learnCard) => {
      console.log(`Calling ${method} with params:`, params);
      try {
        const result = await learnCard.invoke[method](...params);
        console.log(`${method} result:`, result);
        return result;
      } catch (error) {
        console.error(`${method} error:`, error);
        throw error;
      }
    }
  }
};

const learnCard = await initLearnCard({
  seed: yourSeed,
  plugins: [loggingPlugin]
});

// Now wrap any method call
const result = await learnCard.invoke.intercept('verifyCredential', [credential]);

Inspect Credential Structure

For verification issues, inspect the credential structure:

function inspectCredential(credential) {
  console.log('===== CREDENTIAL INSPECTION =====');
  console.log('Types:', credential.type);
  console.log('Issuer:', credential.issuer);
  console.log('Subject:', credential.credentialSubject.id);
  console.log('Proof type:', credential.proof?.type);
  console.log('Issuance date:', credential.issuanceDate);
  console.log('Expiration date:', credential.expirationDate);
  console.log('================================');
}

Getting Help

If you continue to experience issues after trying the solutions in this guide:

  1. Submit a detailed bug report with:

    • LearnCard SDK version

    • Node.js/browser version

    • Complete error message and stack trace

    • Minimal reproducible example

    • Environment details (OS, deployment context)

PreviousDeploymentNextChangelog

Last updated 2 months ago

Was this helpful?

Check the for open issues

Join the for community support

🛠️
GitHub repository
Learning Economy Discord