mesg-foundation / engine

Build apps or autonomous workflows with reusable, shareable integrations connecting any service, app, blockchain or decentralized network.
https://mesg.com/
Apache License 2.0
130 stars 13 forks source link

Cannot start a service deployed using the command deploy #1022

Closed NicolasMahe closed 5 years ago

NicolasMahe commented 5 years ago

Related to https://github.com/mesg-foundation/cli/pull/32 and https://github.com/mesg-foundation/engine/pull/1014

I got a weird error when I want to start a service deployed with this new command:

➜  cli git:(feature/new-deploy) ./bin/run service:start CfXKjFHwNo8GXyyg5qpEWaHzb6ec27NCma52k1hgUEBw
Start service... !
Error: 2 UNKNOWN: Error response from daemon: rpc error: code = InvalidArgument desc = name must be valid as a DNS name component
    at Object.exports.createStatusError (~/Developments/MESG/cli/node_modules/grpc/src/common.js:91:15)
    at Object.onReceiveStatus (~/Developments/MESG/cli/node_modules/grpc/src/client_interceptors.js:1204:28)
    at InterceptingListener._callNext (~/Developments/MESG/cli/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (~/Developments/MESG/cli/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (~/Developments/MESG/cli/node_modules/grpc/src/client_interceptors.js:845:24)

I previously executed the command:

./bin/run service:newdeploy "$(./bin/run service:compile ../services/service-ethereum)"

It returned:

Deploy service... com.mesg.ethereum (CfXKjFHwNo8GXyyg5qpEWaHzb6ec27NCma52k1hgUEBw)

The command service list of the Go cli show this service:

➜  ~ mesg-core service list
HASH                                            SID                  NAME               STATUS     
CfXKjFHwNo8GXyyg5qpEWaHzb6ec27NCma52k1hgUEBw    com.mesg.ethereum    Ethereum           stopped    
3CaMQXGGRZbhrTX1uk3yTwcyBEja4nHbNuxSuuW2tug6    marketplace          Marketplace        running    
DUKu7QydSpbSQXxch3ZNrJYWXMigh3iwC9EnNgQeRmjw    ethwallet            Ethereum Wallet    running  
NicolasMahe commented 5 years ago

The command service:detail returns a correct service definition:

cli git:(feature/new-deploy) ./bin/run service:detail CfXKjFHwNo8GXyyg5qpEWaHzb6ec27NCma52k1hgUEBw
[
  {
    "status": 1,
    "definition": {
      "name": "Ethereum",
      "description": "Ethereum Service to interact with any Smart Contract",
      "tasks": [
        {
          "name": "Execute a Smart Contract Method",
          "description": "This task executes a method on any Smart Contract",
          "inputs": [
            {
              "name": "Method ABI",
              "description": "The ABI of the method to execute. Only pass the ABI of the method and NOT all the Smart Contract's ABI.",
              "type": "Any",
              "key": "methodAbi"
            },
            {
              "name": "Inputs",
              "description": "The inputs to use during the execution of the method. Pass an Object with parameter's name as key and parameter's value as value.",
              "type": "Any",
              "key": "inputs"
            },
            {
              "name": "Contract address",
              "description": "The address of the contract",
              "type": "String",
              "key": "contractAddress"
            },
            {
              "name": "Signer private key",
              "description": "The private key to sign the transaction",
              "type": "String",
              "key": "privateKey"
            },
            {
              "type": "String",
              "optional": true,
              "key": "value"
            },
            {
              "name": "Gas Price",
              "description": "The gas price in wei to use for this transaction",
              "type": "String",
              "optional": true,
              "key": "gasPrice"
            },
            {
              "name": "Gas Limit",
              "description": "The maximum gas provided for this transaction",
              "type": "Number",
              "optional": true,
              "key": "gas"
            }
          ],
          "outputs": [
            {
              "name": "Success",
              "description": "Output when the task executes successfully"
            },
            {
              "name": "Error",
              "description": "Output when an error occurs"
            }
          ],
          "key": "executeSmartContractMethod"
        },
        {
          "name": "Call a Smart Contract Method",
          "description": "This task call a 'constant' method on any Smart Contract. It does not require fees.",
          "inputs": [
            {
              "name": "Method ABI",
              "description": "The ABI of the method to execute. Only pass the ABI of the method and NOT all the Smart Contract's ABI.",
              "type": "Any",
              "key": "methodAbi"
            },
            {
              "name": "Inputs",
              "description": "The inputs to use during the execution of the method. Pass an Object with parameter's name as key and parameter's value as value.",
              "type": "Any",
              "key": "inputs"
            },
            {
              "name": "Contract address",
              "description": "The address of the contract",
              "type": "String",
              "key": "contractAddress"
            }
          ],
          "outputs": [
            {
              "name": "Success",
              "description": "Output when the task executes successfully"
            },
            {
              "name": "Error",
              "description": "Output when an error occurs"
            }
          ],
          "key": "callSmartContractMethod"
        },
        {
          "inputs": [
            {
              "type": "Any",
              "key": "abi"
            },
            {
              "type": "String",
              "key": "address"
            },
            {
              "type": "String",
              "key": "data"
            },
            {
              "type": "Any",
              "key": "topics"
            },
            {
              "type": "Number",
              "key": "logIndex"
            },
            {
              "type": "String",
              "key": "transactionHash"
            },
            {
              "type": "Number",
              "key": "transactionIndex"
            },
            {
              "type": "String",
              "key": "blockHash"
            },
            {
              "type": "Number",
              "key": "blockNumber"
            }
          ],
          "outputs": [
            {},
            {
              "name": "Error",
              "description": "Output when an error occurs"
            }
          ],
          "key": "decodeLog"
        }
      ],
      "events": [
        {
          "data": [
            {
              "type": "String",
              "key": "address"
            },
            {
              "type": "String",
              "key": "data"
            },
            {
              "type": "Any",
              "key": "topics"
            },
            {
              "type": "Number",
              "key": "logIndex"
            },
            {
              "type": "String",
              "key": "transactionHash"
            },
            {
              "type": "Number",
              "key": "transactionIndex"
            },
            {
              "type": "String",
              "key": "blockHash"
            },
            {
              "type": "Number",
              "key": "blockNumber"
            }
          ],
          "key": "log"
        },
        {
          "data": [
            {
              "type": "Number",
              "key": "number"
            },
            {
              "type": "String",
              "key": "hash"
            },
            {
              "type": "String",
              "key": "parentHash"
            },
            {
              "type": "String",
              "key": "sha3Uncles"
            },
            {
              "type": "String",
              "key": "logsBloom"
            },
            {
              "type": "String",
              "key": "stateRoot"
            },
            {
              "type": "String",
              "key": "miner"
            },
            {
              "type": "String",
              "key": "extraData"
            },
            {
              "type": "Number",
              "key": "gasLimit"
            },
            {
              "type": "Number",
              "key": "gasUsed"
            },
            {
              "type": "Number",
              "key": "timestamp"
            },
            {
              "type": "Number",
              "key": "size"
            },
            {
              "type": "String",
              "key": "difficulty"
            }
          ],
          "key": "block"
        },
        {
          "data": [
            {
              "type": "String",
              "key": "transactionHash"
            },
            {
              "type": "Number",
              "key": "transactionIndex"
            },
            {
              "type": "String",
              "key": "blockHash"
            },
            {
              "type": "Number",
              "key": "blockNumber"
            },
            {
              "type": "String",
              "key": "from"
            },
            {
              "type": "String",
              "optional": true,
              "key": "to"
            },
            {
              "type": "Boolean",
              "key": "status"
            },
            {
              "type": "String",
              "key": "value"
            },
            {
              "type": "String",
              "key": "gasPrice"
            },
            {
              "type": "Number",
              "key": "gas"
            },
            {
              "type": "Number",
              "key": "gasUsed"
            },
            {
              "type": "String",
              "key": "input"
            },
            {
              "type": "String",
              "optional": true,
              "key": "contractAddress"
            },
            {
              "type": "Number",
              "key": "cumulativeGasUsed"
            },
            {
              "type": "Object",
              "optional": true,
              "key": "logs",
              "repeated": true,
              "object": [
                {
                  "type": "String",
                  "key": "address"
                },
                {
                  "type": "String",
                  "key": "data"
                },
                {
                  "type": "String",
                  "key": "topics",
                  "repeated": true
                },
                {
                  "type": "Number",
                  "key": "logIndex"
                },
                {
                  "type": "String",
                  "key": "transactionHash"
                },
                {
                  "type": "Number",
                  "key": "transactionIndex"
                },
                {
                  "type": "String",
                  "optional": true,
                  "key": "blockHash"
                },
                {
                  "type": "Number",
                  "key": "blockNumber"
                }
              ]
            }
          ],
          "key": "transaction"
        }
      ],
      "configuration": {},
      "hash": "CfXKjFHwNo8GXyyg5qpEWaHzb6ec27NCma52k1hgUEBw",
      "sid": "com.mesg.ethereum"
    }
  }
]
ilgooz commented 5 years ago

@NicolasMahe I've locally fixed this but didn't create a PR for now since service:start is meant to be used with service:deploy. I'm experimenting with new deploy & start commands and I'll create some fix PRs to complete missing parts of new deploy afterwards.

This issue is related to missing "service" key on service definition's Configuration. It also misses holding the default env vars given by the compile command.