The Problem
I’m struggling to update an NFT’s metadata using Metaplex. I’ve already made an NFT successfully, but now I’m hitting a wall trying to change its info.
What I’ve Tried
I’m using Metaplex-foundation/js (version 0.11.7) and Solana-Wallet-Adapter (version 0.9.16) in a Create-React-App 5 project.
Here’s my update function:
const updateNFTInfo = async () => {
const nftKey = new PublicKey(nftAddress);
try {
const { updatedToken } = await metaplex.nfts().update({
nftOrSft: nftKey,
uri: 'https://example.com/new-metadata.json'
});
console.log('Updated:', updatedToken);
} catch (error) {
console.error('Update failed:', error);
}
};
The Error
When I run this, I get a weird error:
TypeError: Cannot read properties of undefined (reading 'toBuffer')
It seems to be happening in the findMetadataPda function. Any ideas what’s going wrong or how to fix this? I’m pretty lost here.
yo brilliantcoder39, that error’s a pain! i’ve hit it before. double-check ur metaplex setup - sometimes it’s not initialized right. also, make sure ur using the latest @metaplex-foundation/js version. might fix ur issue. if not, try logging the nftKey before the update. could be something funky with the address. good luck man!
hey there BrilliantCoder39! that error sounds super frustrating, i feel your pain
have you tried double-checking that your nftAddress is valid? sometimes i’ve run into similar issues when the address wasn’t quite right. also, are you sure the metaplex instance is properly initialized? maybe try logging it before the update function to make sure it’s not undefined?
btw, what kind of nft are you working on? i’m always curious to hear about cool projects!
and have you considered using a different version of metaplex-foundation/js? sometimes updating or even downgrading can solve weird errors like this.
let us know if you figure it out or if you need more help! good luck with your nft adventure! 
I encountered a similar issue recently. The problem might be in how you’re initializing the Metaplex instance. Make sure you’re passing the correct connection and wallet objects when creating it. Here’s a snippet that worked for me:
const connection = new Connection(clusterApiUrl('devnet'));
const wallet = useWallet();
const metaplex = Metaplex.make(connection).use(walletAdapterIdentity(wallet));
Also, verify that your nftAddress is indeed a valid PublicKey. You could try wrapping the update function in a try-catch block to get more detailed error information. If the issue persists, consider logging the entire nftKey object before the update call to ensure it’s properly formed.