Related Feature
Feature request: Secure Store / Backend Proxy Authentication
Description
When using pnpm as the package manager, the @sap-ux/store package fails to load the optional @zowe/secrets-for-zowe-sdk dependency. This causes the secure store functionality to fall back to DummyStore, which means automatic SAP backend authentication does not work.
The root cause is that pnpm uses a strict isolated node_modules structure (.pnpm/<package>@<version>/node_modules/<package>), and the current code in loadZoweSecretSdk() (in packages/store/src/secure-store/index.ts) only handles:
- Direct
require('@zowe/secrets-for-zowe-sdk')
- VS Code extension paths (
~/.vscode/extensions/sapse.sap-ux-application-modeler-extension-*/...)
Neither of these work with pnpm's symlinked structure.
Steps to Reproduce
- Create a UI5/Fiori project using pnpm as the package manager
- Add
@sap-ux/backend-proxy-middleware as a dependency
- Configure the backend proxy in
ui5.yaml
- Run
pnpm start
Expected results
The Zowe secrets SDK should be loaded successfully, enabling secure credential storage and automatic SAP backend authentication.
Actual results
The following warning appears in the console:
warn backend-proxy-middleware Cannot find module '@zowe/secrets-for-zowe-sdk'
The secure store falls back to DummyStore, and automatic login to the SAP backend no longer works. Users must re-enter credentials.
Screenshots
N/A
Version/Components/Environment
- @sap-ux/store version: 1.5.11 / 1.5.12 (latest)
- @sap-ux/backend-proxy-middleware version: 0.11.3
- Package Manager: pnpm v10.26.1
- Node.js: v22.x
OS:
Additional Technical Context
Why pnpm is Different
pnpm stores packages in a content-addressable store and uses symlinks. The actual module location is:
node_modules/.pnpm/@zowe+secrets-for-zowe-sdk@8.x.x/node_modules/@zowe/secrets-for-zowe-sdk
Standard require() cannot resolve this path when the consuming package (@sap-ux/store) is itself inside the .pnpm structure.
Proposed Solution
Add a fallback in loadZoweSecretSdk() that searches for the Zowe SDK in pnpm's .pnpm directory structure by traversing up from __dirname and looking for @zowe+secrets-for-zowe-sdk@* directories.
Workaround
Add the following to your .npmrc file to hoist the @zowe/secrets-for-zowe-sdk package to the root node_modules:
public-hoist-pattern[]=@zowe/secrets-for-zowe-sdk
Then reinstall dependencies:
This makes the package resolvable via standard require() by placing it in the root node_modules directory alongside the symlinked structure.
Impact
This affects all users who use pnpm as their package manager and rely on @sap-ux/backend-proxy-middleware for development proxy with automatic SAP backend authentication. With the increasing adoption of pnpm (especially in monorepo setups), this is becoming a more common issue.
Related Feature
Feature request: Secure Store / Backend Proxy Authentication
Description
When using pnpm as the package manager, the
@sap-ux/storepackage fails to load the optional@zowe/secrets-for-zowe-sdkdependency. This causes the secure store functionality to fall back toDummyStore, which means automatic SAP backend authentication does not work.The root cause is that pnpm uses a strict isolated
node_modulesstructure (.pnpm/<package>@<version>/node_modules/<package>), and the current code inloadZoweSecretSdk()(inpackages/store/src/secure-store/index.ts) only handles:require('@zowe/secrets-for-zowe-sdk')~/.vscode/extensions/sapse.sap-ux-application-modeler-extension-*/...)Neither of these work with pnpm's symlinked structure.
Steps to Reproduce
@sap-ux/backend-proxy-middlewareas a dependencyui5.yamlpnpm startExpected results
The Zowe secrets SDK should be loaded successfully, enabling secure credential storage and automatic SAP backend authentication.
Actual results
The following warning appears in the console:
The secure store falls back to
DummyStore, and automatic login to the SAP backend no longer works. Users must re-enter credentials.Screenshots
N/A
Version/Components/Environment
OS:
Additional Technical Context
Why pnpm is Different
pnpm stores packages in a content-addressable store and uses symlinks. The actual module location is:
Standard
require()cannot resolve this path when the consuming package (@sap-ux/store) is itself inside the.pnpmstructure.Proposed Solution
Add a fallback in
loadZoweSecretSdk()that searches for the Zowe SDK in pnpm's.pnpmdirectory structure by traversing up from__dirnameand looking for@zowe+secrets-for-zowe-sdk@*directories.Workaround
Add the following to your
.npmrcfile to hoist the@zowe/secrets-for-zowe-sdkpackage to the rootnode_modules:Then reinstall dependencies:
This makes the package resolvable via standard
require()by placing it in the rootnode_modulesdirectory alongside the symlinked structure.Impact
This affects all users who use pnpm as their package manager and rely on
@sap-ux/backend-proxy-middlewarefor development proxy with automatic SAP backend authentication. With the increasing adoption of pnpm (especially in monorepo setups), this is becoming a more common issue.