js icon indicating copy to clipboard operation
js copied to clipboard

Error when Calling uploadMetadata method()

Open MNaguib2611 opened this issue 3 years ago • 4 comments

I am getting the below error whenever I try to use the uploadMetadata method() from my react project i am using other methods like getNftByCreator () without any issues

Uncaught (in promise) TypeError: _bundlr_network_client__WEBPACK_IMPORTED_MODULE_0__ is not a constructor at BundlrStorageDriver.initNodeBundlr (BundlrStorageDriver.ts:195:1) at BundlrStorageDriver.initBundlr (BundlrStorageDriver.ts:175:1) at BundlrStorageDriver.bundlr (BundlrStorageDriver.ts:162:1) at BundlrStorageDriver.uploadAll (BundlrStorageDriver.ts:84:1) at StorageClient.uploadAll (StorageClient.ts:45:1) at Object.handle (uploadMetadata.ts:33:1) at Task.callback (OperationClient.ts:66:1) at Task.ts:82:1 at Disposable.run (Disposable.ts:34:1) at Task.forceRun (Task.ts:74:1)

const fromWallet = Keypair.generate(); console.log(fromWallet); const connection = new Connection(clusterApiUrl("devnet")); const metaplex = Metaplex.make(connection) .use(keypairIdentity(fromWallet)) .use( bundlrStorage({ address: "https://devnet.bundlr.network", providerUrl: "https://api.devnet.solana.com", timeout: 60000, }) );

const { uri } = await metaplex.nfts().uploadMetadata({ name: "My NFT", description: "My description", image: "https://arweave.net/rP-4r6VookQuSb8IjEep5bZgh6Z7c-MAW8uTkhtczOw", });

Someone else on stackoverflow have my same issue

https://stackoverflow.com/questions/72626538/typeerror-bundlr-network-client-webpack-imported-module-0-is-not-a-construc

MNaguib2611 avatar Jun 17 '22 16:06 MNaguib2611

Keypair wallets only work on nodes, because you deploy them on the web. You must use a wallet adapter. so, bundlr need confirmation signature to upload and verify transaction

mrdhanz avatar Jun 20 '22 12:06 mrdhanz

Keypair wallets only work on nodes, because you deploy them on the web. You must use a wallet adapter. so, bundlr need confirmation signature to upload and verify transaction

thank you for your response how can I use walletAdapter with the current connected phantom wallet ?

MNaguib2611 avatar Jun 20 '22 18:06 MNaguib2611

Hey 👋 Whilst typically you'd use the wallet adapter in the browser, you should also be able to handle Keypairs there. I'll try to find time to investigate this issue as soon as I can. Thank you for your understanding. 🌺

lorisleiva avatar Jun 20 '22 19:06 lorisleiva

After using the adapter from https://github.com/solana-labs/wallet-adapter I was finally able to use the uploadMetadata() and minted my first NFT through react app

I was not able to use the function by using the keypairIdentity, only walletAdapterIdentity worked for me

Thank you @lorisleiva @mrdhanz for your help ,I really appreciate it

MNaguib2611 avatar Jun 20 '22 19:06 MNaguib2611

After using the adapter from https://github.com/solana-labs/wallet-adapter I was finally able to use the uploadMetadata() and minted my first NFT through react app

I was not able to use the function by using the keypairIdentity, only walletAdapterIdentity worked for me

Thank you @lorisleiva @mrdhanz for your help ,I really appreciate it

Hi, can you send me the creating NFT codes? or metaplex compatible version? I got errors while creating. I followed js-example codes too. And which network did you mint? Testnet or Devnet?

dreamsea503 avatar Sep 26 '22 13:09 dreamsea503

Hi there 👋

I'm going to close this due to inactivity but feel free to open a new issue using the latest version with updated information if you need to.

Thank you for your understanding.

lorisleiva avatar Sep 30 '22 12:09 lorisleiva