k.yrK
Convex Communityโ€ข3y agoโ€ข
9 replies
k.yr

Invalid Modules Error with metaplex and web3js packages

Hi all ๐Ÿ‘‹
When utilizing the packages @metaplex-foundation/js and @solana/web3.js I am encountering the following error

400 Bad Request: UnableToPush: Hit an error while pushing:
InvalidModules: Loading the pushed modules encountered the following
    error:
Failed to analyze metaplex.js: Assignment to constant variable.


Here is my action that is utilising the libraries

"use node";
import { action } from "./_generated/server";
import { v } from "convex/values";
import { Connection, PublicKey } from "@solana/web3.js";
import { Metaplex } from "@metaplex-foundation/js";

const solanaRpc = process.env.CHAINSTACK_URL ?? "null";

export const getMetaplexNfts = action({
  args: { wallet: v.string() },
  handler: async (ctx, args) => {
    const walletKey = new PublicKey(args.wallet);

    const connection = new Connection(solanaRpc);
    const metaplex = new Metaplex(connection);

    const nfts = await metaplex.nfts().findAllByOwner({ owner: walletKey });

    return nfts;
  },
});


Has anyone had success using web3 and metaplex in their convex projects, is there something that I am overlooking here?
Cheers!
Was this page helpful?