cancel
Showing results for 
Search instead for 
Did you mean: 

CAP Hybrid testing is not working: noAuthMethodFound when connecting to Hana

tiosteel1
Discoverer
0 Kudos

Hi colleagues, could you please help me with the hybrid profile setup on Trial account?

I currently have next .cdsrc-private.json:

{
   "requires":{
      "[hybrid]":{
         "db":{
            "binding":{
               "type":"cf",
               "apiEndpoint":"https://api.cf.us10-001.hana.ondemand.com",
               "org":"fcd0e122trial_fcd0e122trial",
               "space":"dev",
               "instance":"hana",
               "key":"hana-key",
               "resolved":false
            },
            "kind":"hana-cloud",
            "pool":{
               "acquireTimeoutMillis":5000,
               "min":0,
               "max":100,
               "fifo":true
            },
            "vcap":{
               "name":"db"
            }
         }
      }
   }
}<br>

also next package.json:

{
   ...,
   "cds":{
      "requires":{
         "[development]":{
            "db":{
               "kind":"sqlite",
               "credentials":{
                  "database":"sqlite.db"
               }
            },
            "auth":{
               "kind":"basic-auth",
               "users":{
                  "login":{
                     "password":"password",
                     "roles":[
                        "Approver",
                        "Commiter"
                     ]
                  }
               }
            }
         },
         "db":{
            "kind":"hana-cloud",
            "deploy-format":"hdbtable"
         },
         "auth":{
            "kind":"xsuaa",
            "pool":{
               "acquireTimeoutMillis":5000,
               "min":0,
               "max":100,
               "fifo":true
            }
         },
         "approuter":{
            "kind":"cloudfoundry"
         },
         "workflowService":{
            "kind":"rest",
            "credentials":{
               "destination":"bpmworkflowruntime"
            }
         }
      }
   }, ...
}

so when I try to launch the hybrid scenario it goes through the basic authentication, but then on first query to Hana it fails on the next source code with the last throw:

node_modules/hdb/lib/protocol/auth/Manager.js

function Manager(options) {
   options = options || {};
   this.user = options.user || '';
   this._authMethod = undefined;
   this._authMethods = [];
   if (options.assertion || (!options.user && options.password && options.password.toString().startsWith("<"))) {
      this._authMethods.push(new SAML(options));
   }
   if (options.token || (!options.user && options.password && options.password.toString().startsWith("ey"))) {
      this._authMethods.push(new JWT(options));
   }
   if (options.sessionCookie) {
      this._authMethods.push(new SessionCookie(options));
   }
   if (options.user && options.password) {
      this._authMethods.push(new SCRAMSHA256(options, true)); // with PBKDF2 
      this._authMethods.push(new SCRAMSHA256(options, false)); // no PBKDF2 
   }
   if (!this._authMethods.length) {
      throw noAuthMethodFound();
   }
}

the "options" variable contains next structure:

{
   "fetchSize":1024,
   "holdCursorsOverCommit":true,
   "scrollableCursor":true,
   "database":"sqlite.db",
   "certificate":"",
   "driver":"com.sap.db.jdbc.Driver",
   "host":"...",
   "port":"443",
   "uaa":{
      "bindingid":"someguid",
      "clientid":"...",
      "clientsecret":"...",
      "identityzone":"f...trial",
      "identityzoneid":"...",
      "tags":[
         "xsuaa"
      ],
      "tenantid":"...",
      "uaadomain":"authentication.us10.hana.ondemand.com",
      "url":"https://fcd0e122trial.authentication.us10.hana.ondemand.com",
      "verificationkey":"..."
   },
   "url":"jdbc:sap://someguid.hana.trial-us10.hanacloud.ondemand.com:443?encrypt=true&validateCertificate=true",
   "ca":"...",
   "useCesu8":true
}


The versions are:

cds -v
@sap/cds: 6.1.3
@sap/cds-compiler: 3.1.2
@sap/cds-dk: 6.1.1
@sap/cds-dk (global): 6.1.1
@sap/cds-foss: 4.0.0
@sap/cds-mtx: -- missing --
@sap/xssec: 3.2.13
Node.js: v16.17.0<br>

Thank you.

gregorw
Active Contributor
0 Kudos

Can you provide the command how you start the test?

tiosteel1
Discoverer
0 Kudos

gregor.wolf as written in CAP guide I did next 2 commands. The error had been raised on quering any db entity.

cds bind -2 my-hana:my-hana-key



cds watch --profile hybrid

before start I deleted the default-env.json so that I tried it with only .cdsrc-private.json

Accepted Solutions (0)

Answers (2)

Answers (2)

gk-patel
Discoverer
0 Kudos

From a comment in this Blog,

https://blogs.sap.com/2022/08/30/testing-your-cap-hana-artifacts-with-jest-including-multitenancy-hd...

I was able to do,

cds bind --profile hybrid --exec npm run test

and then it worked.

epamtiosteel
Explorer
0 Kudos

For a future: the issue caused by binding hana instance directly instead of binding related HDI instance. It works fine with HDI.

Though the hybrid environment is unfortunatelly not allowed to be used with the cds.test which was the goal of my investigation. So it looks like the only way to automatically test something in the cloud is still postman-like tools / request collections.