Skip to main content
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?

 

 

Best answer by David Liu

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

View original
Did this topic help you find an answer to your question?

2 replies

David Liu
Seasoned Practitioner
  • Seasoned Practitioner
  • 15 replies
  • Answer
  • March 1, 2023

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


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings