pin remote add api (/api/v0/pin/remote/add) respond anomaly
- Dominant language
- Go
- Stars
- 17.1k
- Forks
- 3.2k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 11
Description
### Checklist
- [X] This is a bug report, not a question. Ask questions on [discuss.ipfs.io](https://discuss.ipfs.io).
- [X] I have searched on the [issue tracker](https://github.com/ipfs/kubo/issues?q=is%3Aissue) for my bug.
- [X] I am running the latest [kubo version](https://dist.ipfs.tech/#kubo) or have an issue updating.
### Installation method
built from source
### Version
```Text
~$ docker exec ipfs-node1 ipfs version --all
Kubo version: 0.16.0-38117db
Repo version: 12
System version: amd64/linux
Golang version: go1.19.1
~$ docker exec ipfs-cluster1 ipfs-cluster-ctl --version
ipfs-cluster-ctl version 1.0.3
```
### Config
```json
~$ docker exec ipfs-node1 ipfs config show
{
"API": {
"HTTPHeaders": {}
},
"Addresses": {
"API": "/ip4/0.0.0.0/tcp/5001",
"Announce": [],
"AppendAnnounce": [],
"Gateway": "/ip4/0.0.0.0/tcp/8080",
"NoAnnounce": [],
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip6/::/tcp/4001",
"/ip4/0.0.0.0/udp/4001/quic",
"/ip6/::/udp/4001/quic"
]
},
"AutoNAT": {},
"Bootstrap": [
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa"
],
"DNS": {
"Resolvers": {}
},
"Datastore": {
"BloomFilterSize": 0,
"GCPeriod": "1h",
"HashOnRead": false,
"Spec": {
"mounts": [
{
"child": {
"path": "blocks",
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
"sync": true,
"type": "flatfs"
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
},
{
"child": {
"compression": "none",
"path": "datastore",
"type": "levelds"
},
"mountpoint": "/",
"prefix": "leveldb.datastore",
"type": "measure"
}
],
"type": "mount"
},
"StorageGCWatermark": 90,
"StorageMax": "10GB"
},
"Discovery": {
"MDNS": {
"Enabled": true
}
},
"Experimental": {
"AcceleratedDHTClient": false,
"FilestoreEnabled": false,
"GraphsyncEnabled": false,
"Libp2pStreamMounting": false,
"P2pHttpProxy": false,
"StrategicProviding": false,
"UrlstoreEnabled": false
},
"Gateway": {
"APICommands": [],
"HTTPHeaders": {
"Access-Control-Allow-Headers": [
"X-Requested-With",
"Range",
"User-Agent"
],
"Access-Control-Allow-Methods": [
"GET"
],
"Access-Control-Allow-Origin": [
"*"
]
},
"NoDNSLink": false,
"NoFetch": false,
"PathPrefixes": [],
"PublicGateways": null,
"RootRedirect": "",
"Writable": false
},
"Identity": {
"PeerID": "12D3KooWQR5u7kj4MghUaPmQvjYW3MCQWLfEm39wGb8Gu36k24Mc"
},
"Internal": {},
"Ipns": {
"RecordLifetime": "",
"RepublishPeriod": "",
"ResolveCacheSize": 128
},
"Migration": {
"DownloadSources": [],
"Keep": ""
},
"Mounts": {
"FuseAllowOther": false,
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Peering": {
"Peers": null
},
"Pinning": {
"RemoteServices": {
"Dk": {
"API": {
"Endpoint": "http://172.19.0.1:9097"
},
"Policies": {
"MFS": {
"Enable": false,
"PinName": "",
"RepinInterval": ""
}
}
}
}
},
"Plugins": {
"Plugins": null
},
"Provider": {
"Strategy": ""
},
"Pubsub": {
"DisableSigning": false,
"Router": ""
},
"Reprovider": {
"Interval": "12h",
"Strategy": "all"
},
"Routing": {
"Methods": null,
"Routers": null,
"Type": "dht"
},
"Swarm": {
"AddrFilters": null,
"ConnMgr": {
"GracePeriod": "20s",
"HighWater": 900,
"LowWater": 600,
"Type": "basic"
},
"DisableBandwidthMetrics": false,
"DisableNatPortMap": false,
"RelayClient": {},
"RelayService": {},
"ResourceMgr": {},
"Transports": {
"Multiplexers": {},
"Network": {},
"Security": {}
}
}
}
```
### Description
I added local ipfs-cluster (docker latest version) as pinning service at my local ipfs (docker latest version).
In webui, pin/unpin operation works normally.
However, when I request a pin through the API, the result of the first request is returned as failure, and it was confirmed that the CID was actually successfully pinned. And second request for same CID returns success.
First request for cid QmQS4Bb42NMJihi9seMFnNrzM65bqYjXpc7fGG2q7YHAYZ
```
~$ curl -X POST "http://localhost:5001/api/v0/pin/remote/add?service=Dk&arg=QmQS4Bb42NMJihi9seMFnNrzM65bqYjXpc7fGG2q7YHAYZ" -v
* Trying 127.0.0.1:5001...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 5001 (#0)
> POST /api/v0/pin/remote/add?service=Dk&arg=QmQS4Bb42NMJihi9seMFnNrzM65bqYjXpc7fGG2q7YHAYZ HTTP/1.1
> Host: localhost:5001
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Content-Type: application/json
< Server: kubo/0.16.0
< Trailer: X-Stream-Error
< Vary: Origin
< Date: Thu, 06 Oct 2022 08:37:59 GMT
< Transfer-Encoding: chunked
<
**{"Message":"failed to check pin status for requestid=\"QmQS4Bb42NMJihi9seMFnNrzM65bqYjXpc7fGG2q7YHAYZ\" due to error: reason: \"p
in not found\", details: \"\": 404 Not Found","Code":0,"Type":"error"}**
* Connection #0 to host localhost left intact
```
Second request for cid QmQS4Bb42NMJihi9seMFnNrzM65bqYjXpc7fGG2q7YHAYZ
```
~$ curl -X POST "http://localhost:5001/api/v0/pin/remote/add?service=Dk&arg=QmQS4Bb42NMJihi9seMFnNrzM65bqYjXpc7fGG2q7YHAYZ" -v
* Trying 127.0.0.1:5001...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 5001 (#0)
> POST /api/v0/pin/remote/add?service=Dk&arg=QmQS4Bb42NMJihi9seMFnNrzM65bqYjXpc7fGG2q7YHAYZ HTTP/1.1
> Host: localhost:5001
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Content-Type: application/json
< Server: kubo/0.16.0
< Trailer: X-Stream-Error
< Vary: Origin
< X-Chunked-Output: 1
< Date: Thu, 06 Oct 2022 08:38:07 GMT
< Transfer-Encoding: chunked
<
{"Status":"pinned","Cid":"QmQS4Bb42NMJihi9seMFnNrzM65bqYjXpc7fGG2q7YHAYZ","Name":"test01"}
* Connection #0 to host localhost left intact
```
Contributor guide
Assessment
This issue has not been assessed yet.