Im using the infura pinning to subdomains, Im on the binance testnet but whenever I upload the image I get
fetch.browser.js?c17b:107 POST https://bullchordtest.infura-ipfs.io:5001/api/v0/add?stream-channels=true&progress=false net::ERR_CERT_COMMON_NAME_INVALID
Error uploading file: TypeError: Failed to fetch
const projectId = process.env.INFURA_IPFS_PROJECT_ID;
const projectSecret = process.env.INFURA_IPFS_SECRET;
const projectIdAndSecret = `${projectId}:${projectSecret}`;
const auth = `Basic ${Buffer.from(projectIdAndSecret).toString("base64")}`;
const client = create({
host: "bullchordtest.infura-ipfs.io",
port: 5001,
protocol: "https",
headers: {
authorization: auth,
},
});
``
const [fileUrl, setFileUrl] = useState(null);
const [formInput, updateFormInput] = useState({
price: “”,
name: “”,
description: “”,
});
const router = useRouter();
async function onChange(e) {
const file = e.target.files[0];
setFileUrl(URL.createObjectURL(file));
try {
const added = await client.add(file, {
progress: (prog) => console.log(`received: ${prog}`),
});
const url = `https://bullchordtest.infura-ipfs.io/ipfs/${added.path}`;
client.pin.add(added.path).then((res) => {
console.log(res);
setFileUrl(url);
});
} catch (error) {
console.log("Error uploading file: ", error);
}
}
async function uploadToIPFS() {
const { name, description, price } = formInput;
if (!name || !description || !price || !fileUrl) return;
/* first, upload to IPFS */
const data = JSON.stringify({
name,
description,
image: fileUrl,
});
try {
const added = await client.add(data);
const url = `https://bullchordtest.infura-ipfs.io/ipfs/${added.path}`;
/* after file is uploaded to IPFS, return the URL to use it in the transaction */
console.log(url);
return url;
} catch (error) {
console.log("Error uploading file: ", error);
}
}