securekey / fabric-examples

133 stars 58 forks source link

Errors when running fabric-cli #2

Open dklesev opened 7 years ago

dklesev commented 7 years ago

I'm receiving this here:

# command-line-arguments
./fabric-cli.go:32: cannot use flags (type *"github.com/spf13/pflag".FlagSet) as type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/pflag".FlagSet in argument to "github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common".Config().InitLoggingLevel
./fabric-cli.go:33: cannot use flags (type *"github.com/spf13/pflag".FlagSet) as type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/pflag".FlagSet in argument to "github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common".Config().InitUserName
./fabric-cli.go:34: cannot use flags (type *"github.com/spf13/pflag".FlagSet) as type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/pflag".FlagSet in argument to "github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common".Config().InitUserPassword
./fabric-cli.go:35: cannot use flags (type *"github.com/spf13/pflag".FlagSet) as type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/pflag".FlagSet in argument to "github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common".Config().InitConfigFile
./fabric-cli.go:36: cannot use flags (type *"github.com/spf13/pflag".FlagSet) as type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/pflag".FlagSet in argument to "github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common".Config().InitOrdererTLSCertificate
./fabric-cli.go:37: cannot use flags (type *"github.com/spf13/pflag".FlagSet) as type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/pflag".FlagSet in argument to "github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common".Config().InitPrintFormat
./fabric-cli.go:38: cannot use flags (type *"github.com/spf13/pflag".FlagSet) as type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/pflag".FlagSet in argument to "github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common".Config().InitWriter
./fabric-cli.go:39: cannot use flags (type *"github.com/spf13/pflag".FlagSet) as type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/pflag".FlagSet in argument to "github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common".Config().InitOrgIDs
./fabric-cli.go:41: cannot use chaincode.Cmd() (type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/cobra".Command) as type *"github.com/spf13/cobra".Command in argument to mainCmd.AddCommand
./fabric-cli.go:42: cannot use query.Cmd() (type *"github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/cobra".Command) as type *"github.com/spf13/cobra".Command in argument to mainCmd.AddCommand
./fabric-cli.go:42: too many errors
bstasyszyn commented 7 years ago

This usually indicates a vendoring issue. Funny that I'm not seeing these errors. Can you try re-vendoring, i.e. delete vendor/ and run: $ govendor init && govendor add +external

dockeryounger commented 6 years ago

[lab@localhost fabric-cli]$ go run fabric-cli.go query info --cid mychannel [fabriccli] 2018/01/10 06:06:46 UTC - query.glob..func4 -> ERRO Error while running queryInfoAction: Error getting admin channel client: NewUser returned error: Enroll failed: enrollmentSecret required

How to address this error? Thanks for you help!

bstasyszyn commented 6 years ago

This error means that a password is required for the user (you can provide the password with --pw). If you don't specify a user (with --user) then the CLI assumes "User1", which is a pre-enrolled user in the sample fixtures (./fixtures). If you're not starting fabric using the sample fixtures then you'll need to provide a user/password that's valid for your fabric instance.

If you're running fabric from ./fixtures then the following sequence of commands should work:

(1) Start fabric: $ cd ./fixtures $ docker-compose up --force-recreate (2) Create channel (mychannel): $ go run fabric-cli.go channel create (3) Join peers to channel: $ go run fabric-cli.go channel join --user admin (4) go run fabric-cli.go query info

dockeryounger commented 6 years ago

[lab@localhost fabric-cli]$ go run fabric-cli.go query info --cid judes-supply-chain --peer grpc://peer0.judes.com:7051,grpc://peer1.judes.com:7051 [fabriccli] 2018/01/24 08:06:59 UTC - query.glob..func4 -> ERRO Error while initializing queryInfoAction: NewPeer return error: open /home/lab/go_projects/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/fixtures/channel/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem: no such file or directory

dockeryounger commented 6 years ago

[lab@localhost fabric-cli]$ go run fabric-cli.go query channels --peer grpc://peer0.dauto.com:7051 --user username --pw password --orgid DetroitAuto [fabriccli] 2018/01/24 09:29:20 UTC - query.glob..func2 -> ERRO Error while initializing queryChannelsAction: Error getting MSP ID for org [DetroitAuto]: MSP ID is empty for org: DetroitAuto

It can not find the corresponding MSP ID when I specified --orgid parameter.