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

Query returns wrong http code (500) when not existing bucket is used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • None
    • 7.1.1
    • query
    • None
    • Untriaged
    • 1
    • Unknown

    Description

      Any query to not existing bucket returns 500, which means "internal error". Obviously usage of wrong bucket is user error and should lead to 4** error code.

      $  curl -k 'https://Administrator:asdasd@node1.localhost:19498/query/service' -H 'Content-Type: application/json'  --data-raw '{"statement":"CREATE INDEX test_idx ON `test`(Field_1);","pretty":true,"timeout":"600s","client_context_id":"9dda5c69-dff2-4222-ad21-b49c1f995f2e","profile":"timings","scan_consistency":"not_bounded","use_cbo":true,"txtimeout":"120s","controls":true,"tximplicit":false}' -v
      *   Trying ::1...
      * TCP_NODELAY set
      * Connected to node1.localhost (::1) port 19498 (#0)
      * ALPN, offering h2
      * ALPN, offering http/1.1
      * successfully set certificate verify locations:
      *   CAfile: /etc/ssl/cert.pem
        CApath: none
      * TLSv1.2 (OUT), TLS handshake, Client hello (1):
      * TLSv1.2 (IN), TLS handshake, Server hello (2):
      * TLSv1.2 (IN), TLS handshake, Certificate (11):
      * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
      * TLSv1.2 (IN), TLS handshake, Server finished (14):
      * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
      * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
      * TLSv1.2 (OUT), TLS handshake, Finished (20):
      * TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
      * TLSv1.2 (IN), TLS handshake, Finished (20):
      * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
      * ALPN, server accepted to use h2
      * Server certificate:
      *  subject: CN=Couchbase Server Node (node1.localhost)
      *  start date: May 11 17:49:08 2022 GMT
      *  expire date: Aug 13 17:49:08 2024 GMT
      *  issuer: CN=Couchbase Server b60cbfd8
      *  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
      * Using HTTP2, server supports multi-use
      * Connection state changed (HTTP/2 confirmed)
      * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
      * Server auth using Basic with user 'Administrator'
      * Using Stream ID: 1 (easy handle 0x7f8eb9810800)
      > POST /query/service HTTP/2
      > Host: node1.localhost:19498
      > Authorization: Basic QWRtaW5pc3RyYXRvcjphc2Rhc2Q=
      > User-Agent: curl/7.64.1
      > Accept: */*
      > Content-Type: application/json
      > Content-Length: 269
      >
      * Connection state changed (MAX_CONCURRENT_STREAMS == 250)!
      * We are completely uploaded and fine
      < HTTP/2 500
      < content-type: application/json; version=0.0.0-N1QL
      < content-length: 875
      < date: Thu, 12 May 2022 18:53:21 GMT
      <
      {
          "requestID": "6c26a157-accc-41cb-b1c7-f86459d40754",
          "clientContextID": "9dda5c69-dff2-4222-ad21-b49c1f995f2e",
          "errors": [
              {
                  "code": 12003,
                  "msg": "Keyspace not found in CB datastore: default:test - cause: No bucket named test"
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "16.815788ms",
              "executionTime": "16.6864ms",
              "resultCount": 0,
              "resultSize": 0,
              "serviceLoad": 2,
              "errorCount": 1
          },
          "profile": {
              "phaseTimes": {
      	    "parse": "231.25µs",
      	    "plan": "16.409259ms"
      	},
              "requestTime": "2022-05-12T11:53:20.985-07:00",
              "servicingHost": "node1.localhost:9001"
          },
          "controls": {
              "scan_consistency": "unbounded",
              "use_cbo": "true",
              "n1ql_feat_ctrl": "76",
              "stmtType": ""
          }
      }
      

      Attachments

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

        Activity

          People

            timofey.barmin Timofey Barmin
            timofey.barmin Timofey Barmin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty