question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Client modifies configuration object such that it cannot be used again

See original GitHub issue

When passing a config object to new elasticsearch.Client(), the Client modifies the passed in config object in such a way that it cannot be used to create a second client.

Example:

var elasticsearch = require('elasticsearch');

var config = {
    log : "warning"
};

console.dir(config);
var es1 = new elasticsearch.Client(config);
console.dir(config);
var es2 = new elasticsearch.Client(config);
> node es-config-bug.js 
{ log: 'warning' }
{ log: 
   { _events: 
      { closing: [Object],
        error: [Function: bound],
        warning: [Function: bound] } },
  host: 'http://localhost:9200',
  hosts: 'http://localhost:9200',
  maxSockets: 10,
  maxKeepAliveRequests: 0,
  maxKeepAliveTime: 300000 }

/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/log.js:44
      throw new TypeError('Invalid logging output config. Expected either a lo
            ^
TypeError: Invalid logging output config. Expected either a log level, array of log levels, a logger config object, or an array of logger config objects.
    at new Log (/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/log.js:44:13)
    at new Transport (/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/transport.js:17:27)
    at Object.EsApiClient (/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/client.js:49:22)
    at new Client (/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/client.js:60:10)
    at Object.<anonymous> (/Users/jvonnieda/Desktop/test/es-config-bug.js:10:11)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
julien51commented, Jan 15, 2015

IMHO, the library itself should duplicate the object passed when initializing to avoid the hassle of doing so to the implementer.

6reactions
spalgercommented, Mar 29, 2014
Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting crawler configuration options - AWS Glue
Learn about how to configure what a crawler does when it encounters schema changes and partition changes in your data store.
Read more >
Handle configuration changes - Android Developers
Retain an object during a configuration change​​ ViewModel objects are preserved across configuration changes so they are the perfect place to ...
Read more >
Manage clients - Configuration Manager - Microsoft Learn
Learn how to manage clients in Configuration Manager.
Read more >
RFC 6241: Network Configuration Protocol (NETCONF)
NETCONF allows a client to discover the set of protocol extensions ... o state data: The additional data on a system that is...
Read more >
Firepower Management Center Configuration Guide, Version ...
You cannot delete an object that is in use by an active policy. ... an active policy references your object, deploy configuration changes; ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found