Uploaded image for project: 'Couchbase node.js Client Library'
  1. Couchbase node.js Client Library
  2. JSCBC-858

dropScope and dropCollection raise FeatureNotAvailableError instead of the expected {Scope|Collection}NotFoundError

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.2.0
    • library
    • None
    • 1

    Description

      when I await cmgr.dropScope("nonexistent-scope") I’m getting a FeatureNotAvailableError instead of the expected ScopeNotFoundError
       
      Brett Lawson says "Good catch.  Definitely a bug. I think I just need to invert the operations there.  Detecting the explicit not-found before the feature-not-available."

              if (
                errText.includes('not allowed on this version of cluster') ||
                res.statusCode === 404
              ) {
                throw new FeatureNotAvailableError(undefined, errCtx)
              }
              if (errText.includes('not found') && errText.includes('scope')) {
                throw new ScopeNotFoundError(undefined, errCtx)
              }

       

       
      The same issue applies with

      await collectionMgr.dropCollection("nonexistent-collection", "example-scope");

      Also note that https://github.com/couchbase/couchnode/blob/faa22141b3f24150190f50aab80dc46671d6a16c/test/collectionmanager.test.js seems to test for this, so may be worth double checking if it's run correctly.
       

      Attachments

        Issue Links

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

          Activity

            Looks like we should be checking for explicit errors like 'not found' before we fall back to the checks for 'not supported'.

            brett19 Brett Lawson added a comment - Looks like we should be checking for explicit errors like 'not found' before we fall back to the checks for 'not supported'.

            Hey Brett, I'm still getting this error, having run

            npm install couchbase --save 

            and I now have couchbase@3.2.0-dev but get this error:

            ❯ node modules/howtos/examples/collection-manager.js
            scopeAdmin
            create-collection-manager
            create-scope
            The scope already exists
            create-collection
            The scope does not exist
            drop-collection
            ERR: FeatureNotAvailableError: feature not available
                at CollectionManager.<anonymous> (/Users/hakimcassimally/couchbase/docs-sdk-nodejs/node_modules/couchbase/dist/collectionmanager.js:232:31)
                at Generator.next (<anonymous>)
                at fulfilled (/Users/hakimcassimally/couchbase/docs-sdk-nodejs/node_modules/couchbase/dist/collectionmanager.js:5:58) {
              cause: undefined,
              context: HttpErrorContext {
                method: 'DELETE',
                request_path: '/pools/default/buckets/travel-sample/scopes/example-scope/collections/example-collection',
                response_code: 404,
                response_body: '{"errors":{"_":"Scope with name \\"example-scope\\" is not found"}}'
              }
            } 

            hakim.cassimally Hakim Cassimally added a comment - Hey Brett, I'm still getting this error, having run npm install couchbase --save and I now have couchbase@3.2.0-dev but get this error: ❯ node modules/howtos/examples/collection-manager.js scopeAdmin create-collection-manager create-scope The scope already exists create-collection The scope does not exist drop-collection ERR: FeatureNotAvailableError: feature not available at CollectionManager.<anonymous> (/Users/hakimcassimally/couchbase/docs-sdk-nodejs/node_modules/couchbase/dist/collectionmanager.js: 232 : 31 ) at Generator.next (<anonymous>) at fulfilled (/Users/hakimcassimally/couchbase/docs-sdk-nodejs/node_modules/couchbase/dist/collectionmanager.js: 5 : 58 ) { cause: undefined, context: HttpErrorContext { method: 'DELETE' , request_path: '/pools/default/buckets/travel-sample/scopes/example-scope/collections/example-collection' , response_code: 404 , response_body: '{"errors":{"_":"Scope with name \\"example-scope\\" is not found"}}' } }

            Hey Hakim,

            This is actually a slightly different version of this problem and I have filed JSCBC-905 to cover it.

            Cheers, Brett

            brett19 Brett Lawson added a comment - Hey Hakim, This is actually a slightly different version of this problem and I have filed JSCBC-905 to cover it. Cheers, Brett

            People

              brett19 Brett Lawson
              hakim.cassimally Hakim Cassimally
              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