Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-37040

Importing saved Eventing Handlers via the CLI will no longer work (but the UI will)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Critical
    • None
    • 6.5.0, Cheshire-Cat
    • eventing
    • Untriaged
    • Unknown

    Description

      Seems like fix for MB-32244 breaks existing exported configurations that do not have new "language_compatibility" field which is counter intuitive since this is a backward compatibility feature. 

      This issue will impact customers the rely on the CLI for eventing (cURL or couchbase-cli).

      Importing saved Eventing Handlers via the CLI will no longer work (but the UI will)

      curl -s -X POST -d @./verifier_01w_inst01.json -s http://${CB_USERNAME}:${CB_PASSWORD}@localhost:8096/api/v1/functions/verifier_01w_inst01
      {
       "name": "ERR_INVALID_CONFIG",
       "code": 38,
       "description": "Invalid configuration",
       "attributes": null,
       "runtime_info": {
        "code": 38,
        "info": "Language compatibility missing in the configuration"
       }
       
      couchbase-cli eventing-function-setup -c localhost -u $CB_USERNAME -p $CB_PASSWORD --import --name verifier_01w_inst01 --file verifier_01w_inst01.json2
      ERROR: {'code': 38, 'info': 'Language compatibility missing in the configuration'}
      

      Important we use 'verifier_01w_inst01.json' for curl and 'verifier_01w_inst01.json2' for couchbase-cli as the two CLI export-then-import modes do not seem to be cross compatible. But that is another issue for a future dat.

       The attached Eventing Handler/Function was created under 6.5 (source build a 11 days ago) it has been importing fine for several days.  However I know have the above error.  

      Note using the UI the imported function will get a 'tag' or new setting of 6.5.0 (under Settings/Language compatibility).  So it appears that this logic is in the UI not in shared code that underlies both the UI and the CLI.

      If we edit the exported files, e.g. 'verifier_01w_inst01.json' for curl and 'verifier_01w_inst01.json2', and add the missing directive we can indeed use both cURL and couchbase-cli to import the function.

      vi verifier_01w_inst01.json
      (ADD)
      "language_compatibility":"6.5.0",
      

      Now we can do one of the following:

      curl -s -X POST -d @./verifier_01w_inst01.json -s http://${CB_USERNAME}:${CB_PASSWORD}@localhost:8096/api/v1/functions/verifier_01w_inst01
      {
       "code": 0,
       "info": {
        "status": "Stored function: 'verifier_01w_inst01' in metakv",
        "warnings": null
       }
      }
      

      or

      couchbase-cli eventing-function-setup -c localhost -u $CB_USERNAME -p $CB_PASSWORD --import --name verifier_01w_inst01 --file verifier_01w_inst01.json.couchbase-cli.exported
      SUCCESS: Events imported
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jeelan.poola Jeelan Poola
            jon.strabala Jon Strabala
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty