Skip to content

[Bug] Adding something to Object.prototype leads to "unknown non-custom strategy for compiling constraint derivation function" #414

@KaKi87

Description

@KaKi87

Hi,

My project depends on find-my-way through fastify.

For debugging purposes that have nothing to do with either of those, I wanted to temporarily add the following into my code :

Object.prototype.tap = function(fn) { fn(this); return this; };

But suddenly, I encountered the following error :

Error: unknown non-custom strategy for compiling constraint derivation function
   at Constrainer._buildDeriveConstraints (node_modules/find-my-way/lib/constrainer.js:159:17)
   at Constrainer.noteUsage (node_modules/find-my-way/lib/constrainer.js:88:14)
   at Router._on (node_modules/find-my-way/index.js:154:20)
   at Router.on (node_modules/find-my-way/index.js:139:10)
   at Object.addNewRoute (node_modules/fastify/lib/route.js:360:16)
   at Object.route (node_modules/fastify/lib/route.js:261:19)
   at Object.prepareRoute (node_modules/fastify/lib/route.js:167:18)
   at Object._get [as get] (node_modules/fastify/fastify.js:261:34)

I also tried the following but it didn't change anything :

Object.defineProperty(Object.prototype, 'tap', { enumerable: false, value: function (fn) { fn(this); return this; }});

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions