← Developer Forum

Price Feeds·help question

Error loading @pythnetwork/pyth-solana-receiver due to rpc-websockets dependency conflict

Open on dev-forum →Back to forum

:pushpin: Chain: Solana mainnet
:stopwatch: Timestamp: August 4, 2025 – 19:24 IST (13:54 UTC)
:test_tube: Steps to Reproduce:

  1. Set up a Solana TypeScript test project using Pyth SDKs.

  2. Install @pythnetwork/pyth-solana-receiver.

  3. Try running a test file using ts-mocha.

When executing a test that imports PythSolanaReceiver, we encounter the following error:

Error: Package subpath './dist/lib/client' is not defined by "exports" in /node_modules/rpc-websockets/package.json

This seems to originate from a transitive dependency inside @pythnetwork/solana-utils, which in turn is used by pyth-solana-receiver.

:receipt: Relevant Code Snippet:

import { PythSolanaReceiver } from "@pythnetwork/pyth-solana-receiver";

async function getPriceFeedAccount(feedId: string, connection: Connection, wallet: Keypair): Promise<PublicKey> {
  try {
    // Create PythSolanaReceiver instance
    const pythSolanaReceiver = new PythSolanaReceiver({ 
      connection, 
      wallet: wallet as any 
    });
    
    // Get the price feed account address using shard 0
    const priceFeedAccountAddress = pythSolanaReceiver
      .getPriceFeedAccountAddress(0, feedId)
      .toBase58();
    
    const priceFeedAccount = new PublicKey(priceFeedAccountAddress);
    
    console.log("Pyth SDK - Price feed account:", priceFeedAccount.toString());
    console.log("Feed ID:", feedId);

    // Check if the account exists
    const accountInfo = await connection.getAccountInfo(priceFeedAccount);
    if (!accountInfo) {
      console.warn(`Warning: Price feed account ${priceFeedAccount.toString()} does not exist on the blockchain.`);
      console.warn("This might cause issues if the account is required for the transaction.");
    } else {
      console.log("Price feed account exists and has size:", accountInfo.data.length);
    }

    return priceFeedAccount;
  } catch (error) {
    console.error("Error getting price feed account:", error);
    throw error;
  }
}

:bullseye: Issue Summary:

Any help resolving this issue or understanding the required setup would be appreciated. :folded_hands:

Showing the original post only. Read the full thread on dev-forum.pyth.network ↗

Replies: 6
Views: 650
Likes: 0
Posted: 8/5/2025

Source: https://dev-forum.pyth.network/t/error-loading-pythnetwork-pyth-solana-receiver-due-to-rpc-websockets-dependency-conflict/333 · external id 333