Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipfs image upload error: HTTPError: project id required #9

Open
Bhakti087 opened this issue Sep 21, 2022 · 10 comments
Open

ipfs image upload error: HTTPError: project id required #9

Bhakti087 opened this issue Sep 21, 2022 · 10 comments

Comments

@Bhakti087
Copy link

image

@BCWeb3
Copy link

BCWeb3 commented Sep 21, 2022

I have this error too. Any help would be greatly appreciated.

@BCWeb3
Copy link

BCWeb3 commented Sep 26, 2022

I think this is an access issue to Infura's IPFS. Maybe take a look at the following issue page which has updates for Infura and Pinata.

#5

@Coin-Spark
Copy link

Yes @BCWeb3 this is the reason is not working anymore... since Infura closed their free ipfs node on august 2022.

Now you need to access it with a project id and a secret key. You can do it as following:

1
npm i buffer

2 Go to infura.io and create a new IPFS project, you have to fill your credit card details for it to work.. but you have 5gb free and then you pay few cents for every request that exceed the 5GB. once you created it, pick your projectId and secret key from there.

3 on create page do the following ( i commented whats not needed anymore):

import { useState } from "react";
import { ethers } from "ethers";
import { Row, Form, Button } from "react-bootstrap";
import { Buffer } from "buffer";
import { create as ipfsHttpClient } from "ipfs-http-client";

// const client = ipfsHttpClient('https://ipfs.infura.io:5001/api/v0')


const projectId = "your infura project ID";
const projectSecret = "your infura secretKey";
const subdomain = "YOUR_SUBDOMAIN_NAME.infura-ipfs.io";
// Pay attentnion at the space between Basic and the $ in the next line
// encrypt the authorization
const authorization = `Basic ${Buffer.from(`${projectId}:${projectSecret}`).toString("base64")}`;

// with this next variable, you are passing the necessary information in the request to infura, notice authorization
// is being passed as argument headers
const client = ipfsHttpClient({
  host: "infura-ipfs.io",
  port: 5001,
  protocol: "https",
  headers: {
    authorization: authorization,
  },
});

then below, in the same file you change these 2 lines:

// setImage(`https://ipfs.infura.io/ipfs/${result.path}`)
setImage(`${subdomain}/ipfs/${result.path}`);

// const uri = `https://ipfs.infura.io/ipfs/${result.path}`
const uri = `${subdomain}/ipfs/${result.path}`;

@BCWeb3
Copy link

BCWeb3 commented Oct 19, 2022

Thank you so much @Coin-Spark I followed your very clear and helpful instructions and I can now upload and view NFTs. Great!

@YashasHR
Copy link

YashasHR commented Feb 5, 2023

where do we get our subdomain name

@dhiraj-02
Copy link

dhiraj-02 commented Mar 23, 2023

Thank you so much @Coin-Spark I followed your very clear and helpful instructions and I can now upload and view NFTs. Great!

i can view nfts on ipfs server, but those are not seen on my dashboard, please help

@dhruvv173
Copy link

Hey @ethan-crypto, a few people are facing this issue while uploading NFTs to Infura IPFS. It is due to them removing the public domain and now, everyone should have a enabled custom domain to upload a NFT to IPFS.
I have the solved this issue and have the changes ready with code. Can you assign this task to me?

@ethan-crypto
Copy link
Contributor

ethan-crypto commented Apr 24, 2023 via email

@dhruvv173
Copy link

Hey @ethan-crypto I have opened a PR with the fixed code. Could you check it and merge?

@upendra-eth
Copy link

Hello, I've solved all the issues you're experiencing while watching this video in 2023, explained the solution in a video to make it more beginner-friendly, and also uploaded the updated code to my git repository. Please find all links below

Video link - https://youtu.be/rHBuddTLzR0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants