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

[N1QL] javascript functions are not being added to the /api/v1/functions endpoints everytime

    XMLWordPrintable

Details

    Description

      add this javascript function:
      [root@localhost logs]# curl -X POST http://localhost:43381/api/v1/functions -H 'content-type: application/json' -d '{"name":"math","code":"function add(a, b)

      { let data = a + b return data }"}'

      add this javascript function
      [root@localhost ~]# curl -X POST http://localhost:43381/api/v1/functions -H 'content-type: application/json' -d '{"name":"math","code":"function mult(a, b) { let data = a * b; return data; }"}'

      curl the endpoint to see if they are there:
      [root@localhost ~]# curl http://localhost:43381/api/v1/functions -H 'content-type: application/json'
      {"name":"math","id":"85:70:cc:46:27:c9:e5:d","code":"function add(a, b) { let data = a + b return data }

      "}

      Second javascript function was never added. This seems to be an intermittent error, both Evgeny and I have seen it.

      If i try to create a function based on the second method and use it i get an error:
      CREATE FUNCTION javaScriptmult() LANGUAGE JAVASCRIPT AS

      { "math", "mult" }

      select javaScriptmult(6,1)

      this query hangs or throws an error (i've seen both behaviors)

      When i try to cancel it i see this in the logs:
      Client-side error-report for user "Administrator" on node 'ns_1@cb.local':
      User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
      Error cancelling query: {"data":"Unexpected server error","status":500,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"../_p/query/query/service","headers":

      {"Content-Type":"application/json","ns-server-proxy-timeout":601000,"ignore-401":"true","CB-User-Agent":"Couchbase Query Workbench (6.5.0-3790-enterprise)","Accept":"application/json, text/plain, */*","invalid-auth-response":"on","Cache-Control":"no-cache","Pragma":"no-cache","ns-server-ui":"yes"}

      ,"data":

      {"statement":"delete from system:active_requests where clientContextID = \"d4fa5d87-ea7b-4b07-ad5d-32577572a76a\";","pretty":false,"timeout":"600s","client_context_id":"INTERNAL-63f1d0ca-d186-4ac2-90e4-c5406b74bab4"}

      ,"timeout":{"$$state":{"status":0,"pending":[[{"$$state":{"status":0}},null,null,null]]}}},"statusText":"Internal Server Error","xhrStatus":"complete"}

      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:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty