Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to a running ccaas (Nodejs) after installing #225

Open
jasonhtpham opened this issue Jul 29, 2024 · 3 comments
Open

Cannot connect to a running ccaas (Nodejs) after installing #225

jasonhtpham opened this issue Jul 29, 2024 · 3 comments

Comments

@jasonhtpham
Copy link

What happened?

I have been following this guideline to create a platform for my research. I tried to find out how to package a developed chain code and Dockerize it to be used as a ccaas just like this example.

I normally develop chain codes using javascript or typescript. So, I took the asset-transfer-basic-ts sample from the fabric-samples repo, packaged, dockerized and tried to use the same methods in the example to have a ccaas ready. However, it does not work. It keeps returning this error:

failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 10.96.121.26:7052: connect: connection refused"

I guess it is either because of the incorrect dockerization or incorrect setup of addresses when packaging the chain code. So, I tried a number of changes but still could not make it work. I even tried to use the kfsoftware/asset-transfer-ts:latest image, but there is still no luck. These are my connection.json and metadata.json files being used when packaging the chaincode.

# connection.json
{
  "address": "asset-ts:7052",
  "dial_timeout": "10s",
  "tls_required": false
}
# metadata.json
{
    "type": "ccaas",
    "label": "asset-ts"
}

What did you expect to happen?

I expect the chaincode is invocable after successful installation and commitment from the peers just like in this sample.

How can we reproduce it (as minimally and precisely as possible)?

If you follow the guideline at: https://hyperledger.github.io/bevel-operator-fabric/docs/getting-started. Then, at the step "Deploy chaincode container on cluster", instead of using the provided image, if we try to use the kfsoftware/asset-transfer-ts:latest image. Then, when we invoke the chain code, the issue will appear.

Anything else we need to know?

No response

Kubernetes version

This is the config file of my cluster. All details of the setup can be found in the guidelines mentioned above.

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30949
  hostPort: 80
- containerPort: 30950
  hostPort: 443
@jasonhtpham
Copy link
Author

This is the logs inside the typescript chain code's pod:


> asset-transfer@1.0.0 start:server-nontls
> set -x && fabric-chaincode-node server --chaincode-address=$CHAINCODE_SERVER_ADDRESS --chaincode-id=$CHAINCODE_ID

+ fabric-chaincode-node server --chaincode-address=0.0.0.0:7052 --chaincode-id=asset-ts:a77e7e965465fac5806373c77bdb349c0af7568612482ca38fca9dc27f687219
2024-07-29T12:58:40.963Z info [c-api:./lib/annotations/object.js]                 @Object args: Target -> %s "Function" 
2024-07-29T12:58:41.004Z info [c-api:./lib/annotations/transaction.js]            @Param args: "Property Key -> CreateAsset, Param Name -> assetObj, Param Type -> Asset, Description -> Part formed JSON of Asset,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.011Z info [c-api:./lib/annotations/transaction.js]            @Transaction args: "Property Key -> CreateAsset, Commit -> true,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.032Z info [c-api:./lib/annotations/transaction.js]            @Returns args: ", Property Key -> ReadAsset, Return Type -> Asset,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.034Z info [c-api:./lib/annotations/transaction.js]            @Transaction args: "Property Key -> ReadAsset, Commit -> false,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.062Z info [c-api:./lib/annotations/transaction.js]            @Param args: "Property Key -> UpdateAsset, Param Name -> assetObj, Param Type -> Asset, Description -> Part formed JSON of Asset,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.063Z info [c-api:./lib/annotations/transaction.js]            @Transaction args: "Property Key -> UpdateAsset, Commit -> true,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.071Z info [c-api:./lib/annotations/transaction.js]            @Transaction args: "Property Key -> DeleteAsset, Commit -> true,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.073Z info [c-api:./lib/annotations/transaction.js]            @Returns args: ", Property Key -> AssetExists, Return Type -> boolean,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.080Z info [c-api:./lib/annotations/transaction.js]            @Transaction args: "Property Key -> AssetExists, Commit -> false,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.084Z info [c-api:./lib/annotations/transaction.js]            @Transaction args: "Property Key -> TransferAsset, Commit -> true,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.091Z info [c-api:./lib/annotations/transaction.js]            @Returns args: ", Property Key -> GetAllAssets, Return Type -> string,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.093Z info [c-api:./lib/annotations/transaction.js]            @Transaction args: "Property Key -> GetAllAssets, Commit -> false,","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.097Z info [c-api:./lib/annotations/info.js]                   @Info args: "Info -> [object Object],","Target ->","AssetTransferContract" 
2024-07-29T12:58:41.294Z info [c-api:contracts-spi/bootstrap.js]                  No metadata file supplied in contract, introspection will generate all the data  
2024-07-29T12:58:41.748Z info [c-api:fabric-shim/cli]                             Bootstrap process completed

Based on the logs, I guess it is running well. The only concern is the address. If this is the problem, how could I setup the right connection?

@adityajoshi12
Copy link
Contributor

check the chaincode's kuberentes service and verify if the port 7052 is configured properly.

@jasonhtpham
Copy link
Author

I followed the guidelines closely, so I found nothing wrong with the port. However, after a few times just trying again and again. I managed to get it to work without really knowing why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants