launchdarkly / node-server-sdk

LaunchDarkly Server-side SDK for Node
Other
79 stars 65 forks source link

ReferenceError: errResult is not defined #119

Closed scottcorgan closed 6 years ago

scottcorgan commented 6 years ago

After an upgrade to the latest (5.4.0) client and during the incident today, we started getting this error.

Let me know if you need more information.

ReferenceError: errResult is not defined
    at getResultForVariationOrRollout (/var/www/~redacted~/node_modules/ldclient-node/evaluate_flag.js:281:10)
    at /var/www/~redacted~/node_modules/ldclient-node/evaluate_flag.js:128:9
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1126:9
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:473:16
    at replenish (/var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:993:25)
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1002:9
    at _asyncMap (/var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1119:5)
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1205:16
    at Object.mapSeries (/var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1032:16)
    at evalRules (/var/www/~redacted~/node_modules/ldclient-node/evaluate_flag.js:113:9)
    at /var/www/~redacted~/node_modules/ldclient-node/evaluate_flag.js:44:7
    at /var/www/~redacted~/node_modules/ldclient-node/evaluate_flag.js:82:11
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1126:9
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:473:16
    at replenish (/var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:993:25)
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1002:9
    at _asyncMap (/var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1119:5)
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1205:16
    at Object.mapSeries (/var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1032:16)
    at checkPrerequisites (/var/www/~redacted~/node_modules/ldclient-node/evaluate_flag.js:52:11)
    at evalInternal (/var/www/~redacted~/node_modules/ldclient-node/evaluate_flag.js:40:3)
    at Object.evaluate (/var/www/~redacted~/node_modules/ldclient-node/evaluate_flag.js:26:3)
    at /var/www/~redacted~/node_modules/ldclient-node/index.js:299:22
    at replenish (/var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:998:17)
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1002:9
    at eachOfLimit (/var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1027:24)
    at /var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1032:16
    at Object.eachOf (/var/www/~redacted~/node_modules/ldclient-node/node_modules/async/dist/async.js:1103:5)
    at /var/www/~redacted~/node_modules/ldclient-node/index.js:294:15
    at Timeout._onTimeout (/var/www/~redacted~/node_modules/ldclient-node/feature_store.js:12:29)
    at ontimeout (timers.js:475:11)
    at tryOnTimeout (timers.js:310:5)
    at Timer.listOnTimeout (timers.js:270:5)
eli-darkly commented 6 years ago

Very sorry about this. It looks like the wrong function name got into the code during a refactoring, and we did not have adequate test coverage here. I'll have a patch release out shortly.

(FYI, in order for it to get to this particular code, there has to be something invalid about the feature flag being evaluated - for instance, a rule that specifies a nonexistent variation index. So you may want to take a look at your flags to make sure they have the properties you expect them to have. Of course, the proper behavior of the SDK in such a case would be to return the default value and write a warning to the log, not to throw an exception.)

eli-darkly commented 6 years ago

This is fixed in 5.4.1. Please let us know if you see anything like it again.