Solved

Could not publish a datamodel using cdf cli


I am able to login with clientID and client Secret to our test project using cdf cli. Also the “cdf dm create” is working. However, when publishing a graphql using “cdf dm publish” there was always a validation error even using the demo GraphQL data model. Below is the error message:

$ cdf dm publish --file=./test.graphql --external-id="testgraphql1" --space="testgraphql1" --version 1 --verbose
2023-02-28T13:24:31.576Z cdf:middleware:auth Fetching auth token from CDF...
2023-02-28T13:24:31.577Z cdf Getting token via Client Secret
2023-02-28T13:24:31.578Z cdf:auth:client-secret Starting to aquire client credential token
2023-02-28T13:24:32.032Z cdf:middleware:auth Finished fetching auth token from CDF
2023-02-28T13:24:32.038Z cdf:data-models:publish dataModelVersionsHandler initialized
2023-02-28T13:24:32.038Z cdf:data-models:publish Reading graphql file ./test.graphql
2023-02-28T13:24:32.039Z cdf:data-models:publish Schema contents 'type Actor {\r\n' + '  name: String!\r\n' + '  age: Int\r\n' + '}\r\n' + '\r\n' + 'type Movie {\r\n' + '  name: String!\r\n' + '  description: String\r\n' + '  watchedIt: Boolean\r\n' + '  imdbRating: Float\r\n' + '  releasedYear: Int\r\n' + '  gross: Int\r\n' + '  runTime: Int\r\n' + '  actors: [Actor]\r\n' + '}'
2023-02-28T13:24:32.331Z cdf:data-models:publish Publish request result {
  "isSuccess": false,
  "isFailure": true,
  "error": {
    "message": "Your Data Model GraphQL schema contains errors.",
    "type": "VALIDATION",
    "code": 400,
    "errors": [
      {
        "message": "e.replaceAll is not a function",
        "status": 400,
        "errorMessage": "e.replaceAll is not a function"
      }
    ]
  }
}
e.replaceAll is not a function
Your Data Model GraphQL schema contains errors.

 

Could you take a look what could be the root cause?

 

 

icon

Best answer by David Liu 1 March 2023, 10:19

View original

2 replies

Userlevel 4

Hi @Xiaofeng Wang, thank you for reaching out about this error. I was wondering what node version are you running (`node --version`)?  We recommend using at least Node version `16` for the CLI.

 

We will clarify this in the documentation and provide an error check to help make these error more clear.

 

Thanks!

David

Hi David,

 

Thanks for the info. I was using node v14.20 following the instructions when downloading the CLI tool. After upgrading the node I am now able to run the datamodel publish. I still got an error message “The field type 'TimeSeries' is not present when resolving type 'Property' [@36:1]” but I raised the question in a separate thread.

Maybe the prerequisite should be updated for the CDF CLI:

 

Reply