This repository was archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 296
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
Cannot add link to object #536
Copy link
Copy link
Closed
Description
After upgrading from ipfs-api v3.0.0 to v12.1.7, I'm having a problem to use object.patch.addLink (I couldn't find an example on how to use it so maybe I'm doing it wrong).
Expected behaviour
ipfs.object.patch.addLink('QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn', {
name: 'QmaKhL4gTv1B5CHy963L9G6dp8Yqqx66TUUSDrihxAcLvL',
multihash: 'QmaKhL4gTv1B5CHy963L9G6dp8Yqqx66TUUSDrihxAcLvL',
size: 95
})
My assumption is that it would return me a promise than when resolved would give me an object with a new hash.
Current behaviour
When I call the addLink as above, I get an error from ipfs-api (and from go-ipfs daemon).
>> error on add link: { [Error: invalid 'ipfs ref' path] code: 0 }
>> 15:47:15.889 ERROR commands/h: a panic has occurred in the commands handler! handler.go:127
>> 15:47:15.889 ERROR commands/h: runtime error: index out of range handler.go:128
>> goroutine 2058135 [running]:
>> runtime/debug.Stack(0x21, 0xc4202b94b0, 0x260087)
>> /home/whyrusleeping/go/src/runtime/debug/stack.go:24 +0x79
>> runtime/debug.PrintStack()
>> /home/whyrusleeping/go/src/runtime/debug/stack.go:16 +0x22
>> github.com/ipfs/go-ipfs/commands/http.internalHandler.ServeHTTP.func1()
>> /builds/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/commands/http/handler.go:130 +0x160
>> panic(0x8123e0, 0xc4200120c0)
>> /home/whyrusleeping/go/src/runtime/panic.go:458 +0x243
>> github.com/ipfs/go-ipfs/core/commands.glob..func70(0xd63820, 0xc420ff8fc0, 0xd62c00, 0xc420c4e150)
>> /builds/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/core/commands/publish.go:82 +0x856
>> github.com/ipfs/go-ipfs/commands.(*Command).Call(0xe20380, 0xd63820, 0xc420ff8fc0, 0x0, 0x0)
>> /builds/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/commands/command.go:116 +0x286
>> github.com/ipfs/go-ipfs/commands/http.internalHandler.ServeHTTP(0x0, 0xc4200c6e20, 0x1a, 0xc420b8d320, 0xc42033e1e0, 0x98ad28, 0xc42015a180, 0xc4201ae130, 0xe20380, 0xc420b8d230, ...)
>> /builds/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/commands/http/handler.go:186 +0x3d2
>> github.com/ipfs/go-ipfs/commands/http.(*internalHandler).ServeHTTP(0xc42077c960, 0xd59640, 0xc42002a218, 0xc420730b40)
>> <autogenerated>:4 +0x8a
>> gx/ipfs/QmQzTLDsi3a37CJyMDBXnjiHKQpth3AGS1yqwU57FfLwfG/cors.(*Cors).Handler.func1(0xd59640, 0xc42002a218, 0xc420730b40)
>> /builds/distributions/dists/go-ipfs/gopath/src/gx/ipfs/QmQzTLDsi3a37CJyMDBXnjiHKQpth3AGS1yqwU57FfLwfG/cors/cors.go:188 +0xe9
>> net/http.HandlerFunc.ServeHTTP(0xc420282da0, 0xd59640, 0xc42002a218, 0xc420730b40)
>> /home/whyrusleeping/go/src/net/http/server.go:1726 +0x44
>> github.com/ipfs/go-ipfs/commands/http.Handler.ServeHTTP(0x0, 0xc4200c6e20, 0x1a, 0xc420b8d320, 0xc42033e1e0, 0x98ad28, 0x0, 0xc4201ae130, 0xe20380, 0xc420b8d230, ...)
>> /builds/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/commands/http/handler.go:119 +0x5e
>> github.com/ipfs/go-ipfs/commands/http.(*Handler).ServeHTTP(0xc420122ae0, 0xd59640, 0xc42002a218, 0xc420730b40)
>> <autogenerated>:5 +0x96
>> net/http.(*ServeMux).ServeHTTP(0xc420350060, 0xd59640, 0xc42002a218, 0xc420730b40)
>> /home/whyrusleeping/go/src/net/http/server.go:2022 +0x7f
>> net/http.(Handler).ServeHTTP-fm(0xd59640, 0xc42002a218, 0xc420730b40)
>> /home/whyrusleeping/go/src/net/http/h2_bundle.go:4084 +0x4d
>> gx/ipfs/QmR3KwhXCRLTNZB59vELb2HhEWrGy9nuychepxFtj3wWYa/client_golang/prometheus.InstrumentHandlerFuncWithOpts.func1(0xd5a700, 0xc42027e820, 0xc420730b40)
>> /builds/distributions/dists/go-ipfs/gopath/src/gx/ipfs/QmR3KwhXCRLTNZB59vELb2HhEWrGy9nuychepxFtj3wWYa/client_golang/prometheus/http.go:287 +0x2ab
>> net/http.HandlerFunc.ServeHTTP(0xc42077c910, 0xd5a700, 0xc42027e820, 0xc420730b40)
>> /home/whyrusleeping/go/src/net/http/server.go:1726 +0x44
>> net/http.(*ServeMux).ServeHTTP(0xc420350000, 0xd5a700, 0xc42027e820, 0xc420730b40)
>> /home/whyrusleeping/go/src/net/http/server.go:2022 +0x7f
>> net/http.serverHandler.ServeHTTP(0xc42032e480, 0xd5a700, 0xc42027e820, 0xc420730b40)
>> /home/whyrusleeping/go/src/net/http/server.go:2202 +0x7d
>> net/http.(*conn).serve(0xc420c1d900, 0xd5b500, 0xc4200e2a80)
>> /home/whyrusleeping/go/src/net/http/server.go:1579 +0x4b7
>> created by net/http.(*Server).Serve
>> /home/whyrusleeping/go/src/net/http/server.go:2293 +0x44d
I've tried it passing the object I get back from object.get() as well but the problems persists. What am I doing wrong?
More info
- go-ipfs v0.4.5
- node v5.5
- Mac OS X - 10.12.3