adobe / aio-cli

Adobe I/O Extensible CLI
https://www.adobe.io
Apache License 2.0
77 stars 33 forks source link

Add lib-state and lib-file support for local development #449

Open pablomoreno61 opened 1 year ago

pablomoreno61 commented 1 year ago

Expected Behaviour

When running my app in local, runtime actions using lib-state should be able to read/write data using lib-state.

Actual Behaviour

The following error is seen in the logs:

"code": "ERROR_BAD_ARGUMENT",
"message": "[TvmLib:ERROR_BAD_ARGUMENT] ow.auth" is required",
"stacktrace": "TvmLibError: [TvmLib:ERROR_BAD_ARGUMENT] "ow.auth" is required

Reproduce Scenario (including but not limited to)

Within a runtime action add the following code:

this.state = await init();

Steps to Reproduce

Then, run aio app run --local.

Platform and Version

  System:
    OS: macOS 13.0
    CPU: (10) arm64 Apple M1 Max
    Memory: 96.52 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.20.0 - ~/.nvm/versions/node/v16.20.0/bin/node
    Yarn: Not Found
    npm: 8.19.4 - ~/.nvm/versions/node/v16.20.0/bin/npm
  Virtualization:
    Docker: 24.0.2 - /usr/local/bin/docker
  npmGlobalPackages:
    @adobe/aio-cli: Not Found

Sample Code that illustrates the problem

https://github.com/magento-commerce/aio-amazon-sales-channel/blob/main/actions-src/api/account/runtime/getAccounts.ts

Logs taken while reproducing problem

2023-06-26T10:21:28.652289386Z 2023-06-26T10:21:28.651Z [main /guest/amazon-app/api-get-accounts] error: {"message":"Cannot get accounts","error":"{\"sdk\":\"TvmLib\",\"sdkDetails\":{\"config\":{\"ow\":{\"namespace\":\"guest\"}}},\"code\":\"ERROR_BAD_ARGUMENT\",\"message\":\"[TvmLib:ERROR_BAD_ARGUMENT] \\\"ow.auth\\\" is required\",\"stacktrace\":\"TvmLibError: [TvmLib:ERROR_BAD_ARGUMENT] \\\"ow.auth\\\" is required\\n    at new <anonymous> (/nodejsAction/aRNepCyI/index.js:9288:9)\\n    at new TvmClient (/nodejsAction/aRNepCyI/index.js:10302:19)\\n    at Function.init (/nodejsAction/aRNepCyI/index.js:10365:12)\\n    at init (/nodejsAction/aRNepCyI/index.js:31258:27)\\n    at AccountRepository.getState (/nodejsAction/aRNepCyI/index.js:254:57)\\n    at AccountRepository.getAccounts (/nodejsAction/aRNepCyI/index.js:27:33)\\n    at NodeActionRunner.main [as userScriptMain] (/nodejsAction/aRNepCyI/index.js:104:50)\\n    at /nodejsAction/runner.js:112:45\\n    at new Promise (<anonymous>)\\n    at NodeActionRunner.run (/nodejsAction/runner.js:105:16)\"}"}
2023-06-26T10:21:28.652415928Z 2023-06-26T10:21:28.652Z [main /guest/amazon-app/api-get-accounts] info: {"message":"500: [TvmLib:ERROR_BAD_ARGUMENT] \"ow.auth\" is required","params":{}
aiojbot commented 1 year ago

JIRA issue created: https://jira.corp.adobe.com/browse/ACNA-2332