moltin / js-sdk

JavaScript & Node.js SDKs for the Elastic Path Commerce Cloud eCommerce API
http://documentation.elasticpath.com/
MIT License
173 stars 77 forks source link

Regression on the Config class behavior #607

Closed avale-ne closed 2 years ago

avale-ne commented 2 years ago

As part of https://github.com/moltin/js-sdk/commit/c60f3d9e07061b851e095269d888fdf0692dd650 a side-effect was introduced due to the following change:

image

This unexpected side-effect is causing issues when we want to use the in-memory storage. In my case we ran it in a serverless environment that have limited access to the file-system.

The following exceptions is thrown:

Error: ENOENT: no such file or directory, mkdir '/var/task/localStorage'", " at Object.mkdirSync (fs.js:1013:3)", " at LocalStorage._init (/var/task/dist/node_modules/.pnpm/registry.npmjs.org+node-localstorage@2.2.1/node_modules/node-localstorage/LocalStorage.js:183:14)", " at new LocalStorage (/var/task/dist/node_modules/.pnpm/registry.npmjs.org+node-localstorage@2.2.1/node_modules/node-localstorage/LocalStorage.js:124:12)", " at new LocalStorageFactory (/var/task/dist/node_modules/.pnpm/registry.npmjs.org+@moltin+sdk@11.11.0/node_modules/@moltin/sdk/dist/moltin.cjs.js:178:27)", " at new Config (/var/task/dist/node_modules/.pnpm/registry.npmjs.org+@moltin+sdk@11.11.0/node_modules/@moltin/sdk/dist/moltin.cjs.js:274:89)", " at gateway (/var/task/dist/node_modules/.pnpm/registry.npmjs.org+@moltin+sdk@11.11.0/node_modules/@moltin/sdk/dist/moltin.cjs.js:3940:21)

field123 commented 2 years ago

resolved by https://github.com/moltin/js-sdk/pull/666