Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Converting circular structure to JSON #66

Open
moshest opened this issue Dec 14, 2016 · 1 comment
Open

TypeError: Converting circular structure to JSON #66

moshest opened this issue Dec 14, 2016 · 1 comment
Labels

Comments

@moshest
Copy link

moshest commented Dec 14, 2016

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
Copy link
Contributor

mrister commented Aug 21, 2017

This is probably related to usage of JSON.stringify. We should add this as a test case and fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants