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

[UDF] error message reason not being populated correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.1.0
    • 7.1.0
    • js-evaluator
    • None
    • 7.1.0-2383
    • Untriaged
    • 1
    • No

    Description

      Create a library, create a function based on that library, delete the function the UDF is using and try to execute it again.

      curl -X POST http://172.23.120.115:8093/evaluator/v1/libraries/math -u Administrator:password -H 'content-type: application/json' -d 'function adder(a, b)

      { return a + b; }

      function multiplier(a, b)

      { return a * b; }'
      CREATE OR REPLACE FUNCTION func1(a,b) LANGUAGE JAVASCRIPT AS "adder" AT "math"
      EXECUTE FUNCTION func1(1,3)
      curl -X POST http://172.23.120.115:8093/evaluator/v1/libraries/math -u Administrator:password -H 'content-type: application/json' -d 'function multiplier(a, b) { return a * b; }

      '
      EXECUTE FUNCTION func1(1,3)

      {'requestID': '33e815a5-c641-46bc-a404-79ca2a54ce8e', 'signature': None, 'results': [], 'errors': [{'code': 10109, 'msg': "Error executing function 'func1' (math:adder)", 'reason': {'details': None, 'type': 'Exceptions from JS code'}}], 'status': 'errors', 'metrics': {'elapsedTime': '10.604024ms', 'executionTime': '10.51155ms', 'resultCount': 0, 'resultSize': 0, 'serviceLoad': 1, 'errorCount': 1}}

      You used to get an error that said symbol is not a function, I would expect this to be in the details.

      If you instead tried to just run a JS without a library at all you would get this error, which could also be an acceptable error for the above case, since the function adder is now missing.

      CREATE FUNCTION func1(a,b) LANGUAGE JAVASCRIPT AS "adder" AT "math"(the library does not exist in this example)

      EXECUTE FUNCTION func1(1,3)

      {'requestID': '1dce3093-4d64-40b2-b3b6-dfdb1b39e006', 'signature': None, 'results': [], 'errors': [{'code': 10109, 'msg': "Error executing function 'func1' (math:adder)", 'reason': {'details': None, 'type': 'Library or function missing'}}], 'status': 'errors', 'metrics':

      {'elapsedTime': '11.419667ms', 'executionTime': '11.330686ms', 'resultCount': 0, 'resultSize': 0, 'serviceLoad': 1, 'errorCount': 1}

      }

      Attachments

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

        Activity

          People

            ajay.bhullar Ajay Bhullar
            ajay.bhullar Ajay Bhullar
            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