9. Troubleshooting

Common issues and solutions when using the Amadeus Protocol SDK.

Installation Issues

"Module not found" Error

Problem: Cannot find module '@amadeus-protocol/sdk'

Solutions:

  1. Ensure the package is installed:

    npm install @amadeus-protocol/sdk
  2. Check your package.json:

    {
    	"dependencies": {
    		"@amadeus-protocol/sdk": "^1.0.0"
    	}
    }
  3. Clear cache and reinstall:

    npm cache clean --force
    rm -rf node_modules package-lock.json
    npm install

TypeScript Errors

Problem: Type errors when importing

Solutions:

  1. Ensure TypeScript is installed:

  2. Check tsconfig.json:

  3. Restart your TypeScript server/IDE

Node.js Version Issues

Problem: Errors related to Node.js version

Solutions:

  1. Check Node.js version:

  2. Update to Node.js 20+ if needed

  3. Use a version manager like nvm:

Runtime Errors

"Invalid Base58 string"

Problem: Error when decoding Base58 addresses or keys

Causes:

  • Invalid Base58 encoding

  • Missing or extra characters

  • Wrong string format

Solutions:

"Transaction failed: insufficient balance"

Problem: Transaction rejected due to insufficient funds

Solutions:

  1. Check balance before transferring:

  2. Account for transaction fees:

"Request timeout"

Problem: API requests timing out

Causes:

  • Network connectivity issues

  • Node is slow or overloaded

  • Timeout too short

Solutions:

  1. Increase timeout:

  2. Implement retry logic:

"Invalid transaction structure"

Problem: Transaction validation fails

Causes:

  • Transaction not properly built

  • Invalid arguments

  • Wrong contract/function names

Solutions:

  1. Always use TransactionBuilder:

  2. Validate inputs:

"Invalid signature"

Problem: Transaction signature validation fails

Causes:

  • Wrong private key used

  • Transaction modified after signing

  • Corrupted transaction data

Solutions:

  1. Verify private key matches address:

  2. Don't modify transactions after signing:

API Errors

404 Not Found

Problem: Resource not found

Solutions:

400 Bad Request

Problem: Invalid request parameters

Solutions:

  1. Validate inputs before API calls:

  2. Check error response for details:

Network Errors

Problem: Network connectivity issues

Solutions:

  1. Check network connectivity:

  2. Use different node URL:

Transaction Issues

Transaction Stuck/Pending

Problem: Transaction submitted but not confirming

Solutions:

  1. Check transaction status:

  2. Wait for confirmation:

Nonce Collisions

Problem: Multiple transactions with same nonce

Causes:

  • Transactions submitted too quickly

  • Timestamp-based nonce collision

Solutions:

  1. Add delays between transactions:

Wrong Amount

Problem: Amount not matching expected value

Causes:

  • Precision loss from manual calculation

  • Wrong conversion

Solutions:

  1. Always use conversion functions:

  2. Verify amounts:

Encryption Issues

"Decryption failed"

Problem: Cannot decrypt encrypted data

Causes:

  • Wrong password

  • Corrupted encrypted data

  • Missing IV or salt

Solutions:

  1. Verify password:

  2. Ensure all components are present:

Debugging

Enable Verbose Logging

Transaction Inspection

Getting Help

Check Documentation

  1. Review API Reference

  2. Check Examples

  3. Read Best Practices

Common Resources

  • GitHub Issues: Report bugs and request features

  • Documentation: Complete API reference

  • Examples: Real-world usage examples

Reporting Issues

When reporting issues, include:

  1. SDK version

  2. Node.js version

  3. Error message and stack trace

  4. Code snippet that reproduces the issue

  5. Expected vs actual behavior

Next Steps

Last updated