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

SentinelIterator throws error after upgrade from v3 to v4 #936

Closed
haimomesi opened this issue Jul 22, 2019 · 3 comments · Fixed by #937 · May be fixed by raindigi/haraka-plugin-wildduck#3, saurabharch/GraphqlType-API-Registration#3 or AtomicLoans/liquidator#30
Labels

Comments

@haimomesi
Copy link

I get this error after upgrading to the latest version. Sentinels are properly configured.

TypeError: Cannot add property 3, object is not extensible
    at Array.push (<anonymous>)
    at SentinelIterator.add (/Users/mantubeezz/bitbucket/bmi/server/node_modules/ioredis/built/connectors/SentinelConnector/SentinelIterator.js:31:24)
    at result.map.forEach.sentinel (/Users/mantubeezz/bitbucket/bmi/server/node_modules/ioredis/built/connectors/SentinelConnector/index.js:126:47)
    at Array.forEach (<anonymous>)
    at client.sentinel (/Users/mantubeezz/bitbucket/bmi/server/node_modules/ioredis/built/connectors/SentinelConnector/index.js:120:18)
    at tryCatcher (/Users/mantubeezz/bitbucket/bmi/server/node_modules/standard-as-callback/built/utils.js:11:23)
    at promise.then (/Users/mantubeezz/bitbucket/bmi/server/node_modules/standard-as-callback/built/index.js:19:49)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Changing this line from

https://github.com/luin/ioredis/blob/e593e349fd2811eed2f1a369ffb3a06205909482/lib/connectors/SentinelConnector/SentinelIterator.ts#L42

to

this.sentinels = [...this.sentinels, sentinel];

fixed it for me. I wonder why nobody else is getting this :/

@luin
Copy link
Collaborator

luin commented Jul 22, 2019

Thank you for pointing this out. This issue is caused by passing an option that was handled by Object.preventExtensions so that Array#push() fails. I'll create a fix to make sure that the original options are immutable. However, I checked the code of v3, it seems there also has a #push here https://github.com/luin/ioredis/blob/v3.2.2/lib/connectors/sentinel_connector.js#L120, so it seems that v3 should have the same issue.

@haimomesi
Copy link
Author

I've upgraded from v3.2.1 but still, that code lies there as well.
Thank you for the quick reply. Looking forward for the fix 🥇

luin added a commit that referenced this issue Jul 22, 2019
@luin luin closed this as completed in #937 Jul 22, 2019
luin added a commit that referenced this issue Jul 22, 2019
ioredis-robot pushed a commit that referenced this issue Jul 22, 2019
## [4.13.1](v4.13.0...v4.13.1) (2019-07-22)

### Bug Fixes

* keep sentinels of options immutable ([bacb7e1](bacb7e1)), closes [#936](#936)
@ioredis-robot
Copy link
Collaborator

🎉 This issue has been resolved in version 4.13.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

janus-dev87 added a commit to janus-dev87/ioredis-work that referenced this issue Mar 1, 2024
## [4.13.1](redis/ioredis@v4.13.0...v4.13.1) (2019-07-22)

### Bug Fixes

* keep sentinels of options immutable ([bacb7e1](redis/ioredis@bacb7e1)), closes [#936](redis/ioredis#936)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment