I am trying to use the actions cache to persist a token across login runs. The set operation returns success. The value is found in cache in later actions in the same flow. But when initiating a new login flow, the key is consistently not found in cache. Here is a simplified example (which also does not work):
// In action 1
exports.onExecutePostLogin = async (event, api) => {
const cachedValue = api.cache.read('tst')?.value;
console.log('cachedValue: ' + cachedValue);
if (!cachedValue) {
api.cache.set('tst', '1234');
}
}
// In action 2
exports.onExecutePostLogin = async (event, api) => {
const cachedValue = api.cache.read('tst')?.value;
console.log('cachedValue: ' + cachedValue);
}
However many login flows I execute, I always just see “cachedValue: undefined” in the log for action 1, while in the log for action 2 I see “cachedValue: 123”.
Are the cache entries not supposed to persist across logins?