TypeError: Converting circular structure to JSON
moshest opened this issue · 1 comments
moshest commented
Warp data with circular structure return an error which is OK:
"TypeError: Converting circular structure to JSON"
But afterwards any request to the cache will no response anything and got stuck.
const cacheManager = require( 'cache-manager');
const cache = cacheManager.caching({
ttl: 10 * 60, // 10 minutes
store: require('cache-manager-redis')
});
const data = { foo: 'bar' };
data.data = data; // circular structure
cache.set('key', data, (err, result) => {
console.error(err); // TypeError: Converting circular structure to JSON
cache.get('key', (err, res) => {
console.log(err, res); // never called!
});
});
mrister commented
This is probably related to usage of JSON.stringify. We should add this as a test case and fix.