metaplex-foundation / umi

A Solana Framework for JS Clients.
https://umi.typedoc.metaplex.com
MIT License
168 stars 50 forks source link

IrysUploader URI doesn't exists #150

Open sineus opened 2 months ago

sineus commented 2 months ago

After downloading, I have a URI like arweave.net/{:id} but it doesn't work... What can I do? Has Arweave changed the composition of its URLs?

Create umi instance with IrysUploader

const connection = new Connection(RPC);

const umi = createUmi(connection)
  .use(mplCore())
  .use(
    irysUploader({
      timeout: 60000,
    })
  );

const keypair = umi.eddsa.createKeypairFromSecretKey(
  new Uint8Array(SOLANA_WALLET)
);
const signer = createSignerFromKeypair(umi, keypair);

umi.use(signerIdentity(signer));

Get uploaded file and create generic file to upload with umi uploader adapter

const fileBuffer = readFileSync(req.file.path);
    const filename = req.file.originalname;
    const extension = extname(filename);
    const contentType = req.file.mimetype;

    const [uri] = await umi.uploader.upload([
      createGenericFile(fileBuffer, filename, {
        contentType,
        extension,
      }),
    ]);

Then, I get URI like https://arweave.net/{:id} but when I access it, arweave tells me the URL doesn't exist...

See this PR

luke-mjtd commented 2 months ago

I have the same issue. I've tried to replace https://arweave.net/<id> with https://gateway.irys.xyz/<id> and it seems to work as it's referenced in the PR linked above. Waiting for the PR approval to remove my workaround.

mikhd commented 2 months ago

Experiencing the same issue on the devnet, gateway.irys.xyz urls work, whereas arweave.net from umi doesn't.

dtfiedler commented 2 months ago

setting the URL to http://turbo.ardrive.io should fix this - Turbo has a tight integration with http://arweave.net & is supported by the ar.io team

const umi = createUmi(connection)
  .use(mplCore())
  .use(
    irysUploader({
      url: "https://turbo.ardrive.io",
      timeout: 60000,
    })
  );