Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Getting DB Provider error with Adobe IO Rest Service

SahithiMalyala
Level 2
Level 2

Adobe IO Rest service throwing error.  Here is the engineering ticekt raised for the below error.

IOEXT-65. Please provide the cause and solution.

 

Here is the code we are using.


  var processEnv = process.env;
  var namespace = processEnv.__OW_NAMESPACE;
  var auth = processEnv.__OW_API_KEY;
  //console.log("Namespace: " + namespace);
  //console.log("After processEnv");

  let state = await libState.init({ ow: { namespaceauth } });

 

 

 

Error:

2021-11-05 14:37:50.196 INFO [com.tdl.pwa.core.workflows.PushHomePageDataToWorkflow] /content/tcp-pwa/pwa/en/homepage payload response is {"payload":{"response":{"headers":{"date":"Fri, 05 Nov 2021 09:07:49 GMT","x-request-id":"ps4Fp5sx7nNbkS3Y7IsapCuMda4xfLrl","content-length":"636","x-azure-ref":"0ZfSEYQAAAADL1oxU5e3iQripQ6dy0+JoU0lOMzBFREdFMDIwOABiNzdiNjYzMy04ZjcwLTQyNWItOTJiZC03NmFlYmU5YWI5YzU=","x-openwhisk-activation-id":"bd8a5b1bf41a4e718a5b1bf41a1e71bf","access-control-allow-headers":"Authorization, Origin, X-Requested-With, Content-Type, Accept, User-Agent","x-frame-options":"deny","access-control-allow-methods":"OPTIONS, GET, DELETE, POST, PUT, HEAD, PATCH","strict-transport-security":"max-age=7884000; includeSubDomains","access-control-allow-origin":"*","x-content-type-options":"nosniff","x-xss-protection":"1; mode=block","connection":"close","content-type":"application/json","x-cache":"CONFIG_NOCACHE"},"request":{"headers":{"content-length":86,"content-type":"application/json","X-OW-EXTRA-LOGGING":"on","accept":"application/json"},"method":"POST","uri":{"path":"/api/v1/web/homepage-0.0.1/homepageService","hostname":"288455-319plumdinosaur.adobeioruntime.net","protocol":"https:","search":null,"auth":null,"port":443,"query":null,"host":"288455-319plumdinosaur.adobeioruntime.net","href":"https://288455-319plumdinosaur.adobeioruntime.net/api/v1/web/homepage-0.0.1/homepageService","hash":null,"pathname":"/api/v1/web/homepage-0.0.1/homepageService","slashes":true}},"body":{"payload":{"sdkDetails":{"key":"homepage_json"},"code":"ERROR_BAD_CREDENTIALS","stacktrace":"StateLibError: [StateLib:ERROR_BAD_CREDENTIALS] cannot access underlying DB provider, make sure your credentials are valid\n at new <anonymous> (/nodejsAction/OofwFjKo/index.js:719:9)\n at wrap (/nodejsAction/OofwFjKo/index.js:2558:19)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","sdk":"StateLib","message":"[StateLib:ERROR_BAD_CREDENTIALS] cannot access underlying DB provider, make sure your credentials are valid"}},"statusCode":500},"name":"StatusCodeError","options":{"headers":{"X-OW-EXTRA-LOGGING":"on"},"method":"POST","json":true,"simple":true,"body":{"pageInfo.pageName":"Homepage","update":true,"device":"PWA","tcpId":"serversideuser"},"resolveWithFullResponse":false,"transform2xxOnly":false,"uri":"https://288455-319plumdinosaur.adobeioruntime.net/api/v1/web/homepage-0.0.1/homepageService"},"error":{"payload":{"sdkDetails":{"key":"homepage_json"},"code":"ERROR_BAD_CREDENTIALS","stacktrace":"StateLibError: [StateLib:ERROR_BAD_CREDENTIALS] cannot access underlying DB provider, make sure your credentials are valid\n at new <anonymous> (/nodejsAction/OofwFjKo/index.js:719:9)\n at wrap (/nodejsAction/OofwFjKo/index.js:2558:19)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","sdk":"StateLib","message":"[StateLib:ERROR_BAD_CREDENTIALS] cannot access underlying DB provider, make sure your credentials are valid"}},"message":"500 - {\"payload\":{\"code\":\"ERROR_BAD_CREDENTIALS\",\"message\":\"[StateLib:ERROR_BAD_CREDENTIALS] cannot access underlying DB provider, make sure your credentials are valid\",\"sdk\":\"StateLib\",\"sdkDetails\":{\"key\":\"homepage_json\"},\"stacktrace\":\"StateLibError: [StateLib:ERROR_BAD_CREDENTIALS] cannot access underlying DB provider, make sure your credentials are valid\\n at new <anonymous> (/nodejsAction/OofwFjKo/index.js:719:9)\\n at _wrap (/nodejsAction/OofwFjKo/index.js:2558:19)\\n at runMicrotasks (<anonymous>)\\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\"}}","statusCode":500},"error":true}

3 Replies
duypnguyen
Employee
Employee

@SahithiMalyala - could you try state init without custom ow auth. Simply this:

let state = await libState.init();

Why do you need to pass the custom Openwhisk namespace + auth?

SahithiMalyala
Level 2
Level 2

Hi Duynguyen,

 

We are using the ow auth to differentiate the service between dev, stage and Production environments. If we are not using the auth syntax the different environment libstate data is getting merged. This solution is not working for us. 

 

Please provide solution asap. 

duypnguyen
Employee
Employee

@SahithiMalyala - I got your requirement, but why isn't this solution working?

In your App Builder project, there are different workspaces for prod, stage, dev, etc. Each comes with its own Runtime namespace.

If you deploy your app to a namespace, let's say dev, libState.init (without any param) will automatically pick the dev namespace. And the libState data is specific to that dev namespace only.

If you deploy to stage later, you will have fresh data of stage. And the same for prod.

In summary, they don't share any data, because we guarantee tenant isolation between namespaces.

suryapramodhd73
Level 1
Level 1

Am working with @SahithiMalyala .

The issue is very much specific to this workspace. The same set of code is deployed in Dev, SIT, PT, Pre-Prod it works in all environments and breaks only in production. 

 

We tried with clean init() method and that did not work too. It has been burning us from few days now and has been in a pretty red flag for us

duypnguyen
Employee
Employee

@suryapramodhd73 - to make sure I understand the problem correctly, please confirm:

  • the error you described in the original question only occurred in prod namespace, both when you used `stateLib.init()` and `stateLib.init({ ow: { namespace, auth } })`.
  • there was no error in other namespaces, both when you used `stateLib.init()` and `stateLib.init({ ow: { namespace, auth } })`.