Metadata is not uploaded to IPFS

Hello, everyone.
I wish you well.
I uploaded simple metadata to ipfs, but an ERROR occurred.

const ipfsClient = require(“ipfs-http-client”);
const ipfs = ipfsClient({
host: “ipfs.infura.io”,
port: 5001,
protocol: “https”,
});

mintNFT = async () => {
const tokenObject =
{
name: “NFT Token”, image:
https://ipfs.io/ipfs/QmexGL2pVe8dVkmm3soPXBMajvFkjFfjasoxwG2G9fTnX1,
description: “This is NFT token”};
}
const cId = await ipfs.add(JSON.stringify(tokenObject));
}

In code like this, I run the mintNFT function, but I get the following error:

Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
fetch.browser.js:101 Uncaught (in promise) TypeError: Failed to fetch
at fetchWith (:3000/static/js/vendors~main.chunk.js:96524)
at Client.fetch (:3000/static/js/vendors~main.chunk.js:96061)
at Client.fetch (:3000/static/js/vendors~main.chunk.js:92787)
at Client.post (:3000/static/js/vendors~main.chunk.js:96100)
at addAll (:3000/static/js/vendors~main.chunk.js:89487)
at async last (:3000/static/js/vendors~main.chunk.js:105873)
at async Object.add (:3000/static/js/vendors~main.chunk.js:89631)
at async App.mintMyNFT (:3000/main.decf05e7e846426fcf5

please help me.
Thank you very much.

@Sunlight1026 pls edit your message with two code block (one for the code and one for the backtrace), like this:

```js
// Code ...
```
1 Like

Thank you for your reply.

----- Javascript (React.js) ----------------

const ipfsClient = require(“ipfs-http-client”);
const ipfs = ipfsClient({
host: “ipfs.infura.io 1”,
port: 5001,
protocol: “https”,
});

mintNFT = async () => {
const tokenObject =
{
name: “NFT Token”, image:
https://ipfs.io/ipfs/QmexGL2pVe8dVkmm3soPXBMajvFkjFfjasoxwG2G9fTnX1,
description: “This is NFT token”};
}
const cId = await ipfs.add(JSON.stringify(tokenObject));
}

---------------- ERROR ----------------------

fetch.browser.js:101 POST https://ipfs.infura.io:5001/api/v0/add?stream-channels=true&cid-version=1&progress=false&hash=sha2-256 net::ERR_CONNECTION_TIMED_OUT
fetchWith @ fetch.browser.js:101
fetch @ http.js:130
Client.fetch @ core.js:192
post @ http.js:174
addAll @ add-all.js:36
setTimeout (async)
runTimeout @ browser.js:41
push…/node_modules/process/browser.js.process.nextTick @ browser.js:143
(anonymous) @ util.js:694
Promise.then (async)
bound bound request @ util.js:693
push…/node_modules/web3-core-requestmanager/lib/index.js.RequestManager.send @ index.js:155
sendRequest @ index.js:623
send @ index.js:655
_executeMethod @ index.js:797
App.mintMyNFT @ App.js:93
callMint @ Home.jsx:16
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:4070
executeDispatch @ react-dom.development.js:8243
processDispatchQueueItemsInOrder @ react-dom.development.js:8275
processDispatchQueue @ react-dom.development.js:8288
dispatchEventsForPlugins @ react-dom.development.js:8299
(anonymous) @ react-dom.development.js:8508
batchedEventUpdates$1 @ react-dom.development.js:22396
batchedEventUpdates @ react-dom.development.js:3745
dispatchEventForPluginEventSystem @ react-dom.development.js:8507
attemptToDispatchEvent @ react-dom.development.js:6005
dispatchEvent @ react-dom.development.js:5924
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
discreteUpdates$1 @ react-dom.development.js:22413
discreteUpdates @ react-dom.development.js:3756
dispatchDiscreteEvent @ react-dom.development.js:5889
fetch.browser.js:101 Uncaught (in promise) TypeError: Failed to fetch
at fetchWith (fetch.browser.js:101)
at Client.fetch (http.js:130)
at Client.fetch (core.js:192)
at Client.post (http.js:174)
at addAll (add-all.js:36)
at async last (index.js:13)
at async Object.add (add.js:18)
at async App.mintMyNFT (App.js:108)

I was thinking of markdown codeblocks, like this : Extended Syntax | Markdown Guide

net::ERR_CONNECTION_TIMED_OUT just look like you can’t connect to infura.
If you open https://ipfs.infura.io:5001 in your browser, do you see any error message from them ?

1 Like

Thank you very much for your reply.
My guess is that it’s never a markdown codeblocks problem.
I have previously uploaded metadata to IPFS.
However, the same error occurs in the project that was executed before.

https://ipfs.infura.io:5001/
and I can’t access this url.
Is there any ways?
Please help me.

Yes :smiley: that just to make your messages way more readables.

and I can’t access this url.

Contact infura they will know better, I can access it, that very weird, you should too.

Thank you Jorropo.
Your answer is always hele me.
Hope to see you again.