I created a next.js app to upload json
try {
const url = `https://api.pinata.cloud/pinning/pinFileToIPFS`;
const fileRes = await axios.post(url, formData, {
maxBodyLength: Infinity,
headers: {
"Content-Type": `multipart/form-data: boundary=${formData.getBoundary()}`,
pinata_api_key: pinataApiKey,
pinata_secret_api_key: pinataSecretApiKey,
},
});
console.log("fileRes", fileRes.data);
// we need to create formData
return res.status(200).send(fileRes.data);
} catch (error: any) {
console.error("errro in uploading image", error.response.data);
this is the response I get
fileRes {
IpfsHash: 'QmWb63anLitKNrfiZBiyNBLJGbA57vkFqugJUJvUVvvaKi',
PinSize: 35672,
Timestamp: '2022-05-20T17:48:31.784Z'
}
I successfully upload the image, It is in pinata files. But I cannot display. I have this error on console.
net::ERR_SSL_PROTOCOL_ERROR
When i click on the link I get this on browser:
I tried to upload through pinata upload, but I have the same issue.
I tried different images. delete them re-upload them but still error
SOLVED
I changed the DNS server to Cloudflare and it works now.