hyperledger / fabric-gateway

Go, Node and Java client API for Hyperledger Fabric v2.4+
https://hyperledger.github.io/fabric-gateway/
Apache License 2.0
154 stars 92 forks source link

Failure at deployChaincode Step on MacOS #351

Closed jonmchan closed 2 years ago

jonmchan commented 2 years ago

I'm experiencing the following error after a clean clone/install:

deployChaincode
 > docker exec org1_cli peer lifecycle chaincode package basic.tar.gz --lang golang --label basicv1.0.0 --path /opt/gopath/src/github.com/chaincode/golang/basic 

 > docker exec -e CORE_PEER_ADDRESS=peer0.org1.example.com:7051 org1_cli peer lifecycle chaincode install basic.tar.gz 
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image inspection failed: Get "http://unix.sock/images/dev-peer0.org1.example.com-basicv1.0.0-19a006f82e1524e7eaf57968ad8b09eea42ae93829b55c60a40e60ab63d7e344-e73330d47ca9a120ea40e1e54756b432b3a1428290dd9acddaaaacd457552f99/json": dial unix /host/var/run/docker.sock: connect: no such file or directory

    And I deploy golang chaincode named basic at version 1.0.0 for all organizations on channel mychannel with endorsement policy AND("Org1MSP.member","Org2MSP.member") # fabric_test.go:184 -> github.com/hyperledger/fabric-gateway/scenario/go.deployChaincode
    exit status 1: Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image inspection failed: Get "http://unix.sock/images/dev-peer0.org1.example.com-basicv1.0.0-19a006f82e1524e7eaf57968ad8b09eea42ae93829b55c60a40e60ab63d7e344-e73330d47ca9a120ea40e1e54756b432b3a1428290dd9acddaaaacd457552f99/json": dial unix /host/var/run/docker.sock: connect: no such file or directory

I followed the README.md and installed the pre-reqs, then tried both:

make scenario-test-go (results in above error) and make sample-network, which results in a similar error except invoked by the feature test.

  Scenario: Evaluate with result # /Users/jonathan/code/oss/fabric-gateway/scenario/features/transactions.feature:16
    And I deploy golang chaincode named basic at version 1.0.0 for all organizations on channel mychannel with endorsement policy AND("Org1MSP.member","Org2MSP.member") # /Users/jonathan/code/oss/fabric-gateway/scenario/features/transactions.feature:10
      Error: exit status 1: Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image inspection failed: Get "http://unix.sock/images/dev-peer0.org1.example.com-basicv1.0.0-19a006f82e1524e7eaf57968ad8b09eea42ae93829b55c60a40e60ab63d7e344-e73330d47ca9a120ea40e1e54756b432b3a1428290dd9acddaaaacd457552f99/json": dial unix /host/var/run/docker.sock: connect: no such file or directory

It would appear it is trying to use a socket, but it is being utilized as an HTTP host instead of properly hitting the UNIX socket?

denyeart commented 2 years ago

@andrew-coleman Could you take a look?

bestbeforetoday commented 2 years ago

@jonmchan Any chance that you are running on a Mac and have the Docker Desktop setting "Use gRPC FUSE for file sharing" enabled? If so, try disabling that setting. I think that has caused similar issues for me in the past. Although right now (Docker Desktop 4.3.1, MacOS 12.0.1) it seems like having that setting enabled might work OK for me.

jonmchan commented 2 years ago

On MacOS 10.15.7:

Updated from 4.2.0 to 4.3.1, kept Use gRPC FUSE for file sharing enabled, still fails.

Disabled Use gRPC FUSE for file sharing and deploy chaincode steps in both commands work. I was seeing failing tests, but after running Docker Clean / Purge data and Reset to factory defaults, the failing tests went away for make sample-network. The failing tests for make scenario-test-go would not go away.

On several runs, the org1_cli container stops responding during the deployChaincode step, had to kill the make process and even restart docker because the container would not be killed.

Closing this issue as the original issue is resolved.

For reference:

make scenario-test-go

--- Failed steps:

  Scenario: Submit to org1 # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:18
    And I register and enroll an HSM user HSMUser1 in MSP Org1MSP # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:12
      Error: exit status 1

  Scenario: Submit to org2 # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:24
    And I register and enroll an HSM user HSMUser1 in MSP Org1MSP # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:12
      Error: exit status 1

  Scenario: Submit to org3 # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:30
    And I register and enroll an HSM user HSMUser1 in MSP Org1MSP # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:12
      Error: exit status 1

  Scenario: Submit to org1 and org3 # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:36
    And I register and enroll an HSM user HSMUser1 in MSP Org1MSP # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:12
      Error: exit status 1

  Scenario: Evaluate on org1 # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:45
    And I register and enroll an HSM user HSMUser1 in MSP Org1MSP # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:12
      Error: exit status 1

  Scenario: Evaluate on org2 # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:51
    And I register and enroll an HSM user HSMUser1 in MSP Org1MSP # /Users/jonathan/code/oss/fabric-gateway/scenario/features/endorsement_hsm.feature:12
      Error: exit status 1

  Scenario: Submit non-deterministic transaction # /Users/jonathan/code/oss/fabric-gateway/scenario/features/errors.feature:87
    And the error message should contain "failed to assemble transaction: ProposalResponsePayloads do not match" # /Users/jonathan/code/oss/fabric-gateway/scenario/features/errors.feature:91
      Error: transaction error message "rpc error: code = Aborted desc = failed to collect enough transaction endorsements, see attached details for more info" does not contain expected value "failed to assemble transaction: ProposalResponsePayloads do not match"
bestbeforetoday commented 2 years ago

Thank you for all the trial-and-error, and glad you got something (mostly!) working. It should be enough to run any of the samples at least. The HSM tests require a whole bunch of SoftHSM set up, which I'm not convinced works well (if at all) outside of Linux, so I wouldn't worry about them.

jonmchan commented 2 years ago

No problem @bestbeforetoday - definitely very happy to contribute to this really awesome project! We're interested in using hyperledger fabric to integrate with our ruby projects. After reviewing all the documentation and code samples on Fabric Gateway, we were able to build an initial ruby SDK for fabric gateway - https://github.com/EthicalIdentity/fabric-gateway-ruby. It still needs a lot of work to manage the connection and support all the calls instead of directly connecting to the transformed protos, but I'm happy to report that we were at least able to transform the protos and make a successful evaluate call from ruby to our test net.

What's the project stance on porting the SDK to other languages? Is it on the roadmap to port to other languages besides java, go, and javascript?