umi icon indicating copy to clipboard operation
umi copied to clipboard

IrysUploader URI doesn't exists

Open sineus opened this issue 5 months ago • 3 comments

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

sineus avatar Sep 10 '24 09:09 sineus