net :: err_ssl_protocol_error上传图像到pinata

发布于 2025-01-30 12:48:29 字数 1375 浏览 1 评论 0原文

我创建了一个next.js应用来上传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);

这是我得到的响应

fileRes {
  IpfsHash: 'QmWb63anLitKNrfiZBiyNBLJGbA57vkFqugJUJvUVvvaKi',
  PinSize: 35672,
  Timestamp: '2022-05-20T17:48:31.784Z'
}
      

,我成功上传了图像,它在pinata文件中。但是我无法显示。我在控制台上有这个错误。

net::ERR_SSL_PROTOCOL_ERROR

当我单击链接时,我会在浏览器上获取此信息:

我尝试了不同的图像。将它们删除重新上传,但仍然错误

”“在此处输入图像说明”

解决了

我将DNS服务器更改为Cloudflare,现在可以正常工作。

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:

enter image description here

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

enter image description here

SOLVED

I changed the DNS server to Cloudflare and it works now.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文