Skip to content

TypeError: Converting circular structure to JSON #66

Description

@moshest

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!
  });
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions