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

[Eventing] [UI] Parse error & expansion inside of JavaScript comments

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 7.1.0
    • 7.1.0
    • eventing
    • Untriaged
    • 1
    • Yes

    Description

      I noticed that an Eventing function with lots of comments (where the function was made in a 6.6.5 GA version) when imported via the REST API seemed to "gum" up the UI for Eventing making that view non-functional (the target UI with the issue was a recent build Enterprise Edition 7.1.0 build 2175).   Note 7.0.3 GA works fine.

      I had to use "cbevent -user Administrator -password password -flush -host http://localhost:8091" to get the Eventing portion of the UI unstuck.

      Tracking things down it appears that the Function parser is not happy with some text in  /* .... */ c-style comments. 

       

      The following Eventing Function "f_issue_a.json" can be imported BUT it can not be exported

      /*
      evtest0::%id%
      */
      function OnUpdate(doc, meta) {
      }
      

       

      Note if we drop a '%' character from within the above comment I can perform an export "f_issue_a(1).json" but some funny stuff happens in side to comment.

      /*
      evtest0::%id
      */
      function OnUpdate(doc, meta) {
      }
      

      however in the second case the saved JSON payload in the file system from an export appears very odd insertion of text.

      [{"appcode":"/*\nevtest0::%!i(MISSING)d\n*/\n\nfunction OnUpdate(doc, meta)

      And when I import the exported function  "f_issue_a(1).json" then rename it to f_issue_b in the settings I get the following

       

      /*
      evtest0::%!i(MISSING)d
      */
      function OnUpdate(doc, meta) {
      }
      

       

      Attachments

        1. f_issue_a.json
          0.9 kB
        2. f_issue_a (1).json
          0.9 kB
        3. UI_console_error_log.log
          9 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          jon.strabala Jon Strabala added a comment - - edited

          I put the log from the Chrome dev tools console in "UI_console_error_log.log" showing the parse error on the export

          Also the real issue is the '%" character in any comment

          // %

          or

          /*  %  */

           

          // %
           
          function OnUpdate(doc, meta) {
          }
          

           

          jon.strabala Jon Strabala added a comment - - edited I put the log from the Chrome dev tools console in "UI_console_error_log.log" showing the parse error on the export Also the real issue is the '%" character in any comment // % or /*  %  */   // %   function OnUpdate(doc, meta) { }  
          jeelan.poola Jeelan Poola added a comment -

          Pavel Blagodov May I request your help here? Thank yoU!

          jeelan.poola Jeelan Poola added a comment - Pavel Blagodov May I request your help here? Thank yoU!
          jeelan.poola Jeelan Poola added a comment -

          Daniel Owen FYI, eventing team per se has not done any rca or looked into the issue. Since it works in 7.0.3 and we have not made any changes in the code editor page, we suspect it's some generic issue is causing this. Hence the request to help out. Please let us know if eventing team should take a first shot at this. Thank you!

          jeelan.poola Jeelan Poola added a comment - Daniel Owen FYI, eventing team per se has not done any rca or looked into the issue. Since it works in 7.0.3 and we have not made any changes in the code editor page, we suspect it's some generic issue is causing this. Hence the request to help out. Please let us know if eventing team should take a first shot at this. Thank you!
          owend Daniel Owen added a comment -

          Hi Jeelan Poola, Pavel Blagodov has been chatting with Rishit Chaudhary. Would it be OK for him to have an initial look? and then Pavel Blagodov can help if required.

          owend Daniel Owen added a comment - Hi Jeelan Poola , Pavel Blagodov has been chatting with Rishit Chaudhary . Would it be OK for him to have an initial look? and then Pavel Blagodov can help if required.
          jeelan.poola Jeelan Poola added a comment -

          Ok sure Daniel Owen

          jeelan.poola Jeelan Poola added a comment - Ok sure Daniel Owen

          Build couchbase-server-7.1.0-2215 contains eventing commit eaecce5 with commit message:
          MB-50656: Fix arguments to Fprintf

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.1.0-2215 contains eventing commit eaecce5 with commit message: MB-50656 : Fix arguments to Fprintf
          sujay.gad Sujay Gad added a comment -

          Verified the fix on Enterprise Edition 7.1.0 build 2235.

          sujay.gad Sujay Gad added a comment - Verified the fix on Enterprise Edition 7.1.0 build 2235.

          People

            sujay.gad Sujay Gad
            jon.strabala Jon Strabala
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty