Hello!
When I connect to my local database, everything works fine.
But connecting to Atlas produces the following error:
MongoError: The field 'retryWrites' is not valid for an index specification. Specification: { name: "findAndLockNextJobIndex", key: { name: 1, nextRunAt: 1, priority: -1, lockedAt: 1, disabled: 1 }, retryWrites: true }
Anything I can do to make it working?
Yep! Fix coming (#674). Closing this and keeping tabs on https://github.com/agenda/agenda/issues/673
I would like to reopen this issue. #674 does not address the MongoError when connecting to Atlas and retryWrites=true. 674 handles Username contains an illegal unescaped character. I have tested the fix and it corrects the illegal character but not this bug.
{ message: 'The field \'retryWrites\' is not valid for an index specification.
Specification: {
name: "findAndLockNextJobIndex",
key: { name: 1, nextRunAt: 1, priority: -1, lockedAt: 1, disabled: 1 }, retryWrites: true }',
stack: 'MongoError: The field \'retryWrites\' is not valid for an index specification.
Specification: { name: "findAndLockNextJobIndex", key: { name:1, nextRunAt: 1, priority: -1, lockedAt: 1, disabled: 1 }, retryWrites: true }\n
at /Users/bdegannes/blaine/musical-umbrella-api/node_modules/mongodb-core/lib/connection/pool.js:581:63\n
at authenticateStragglers (/Users/bdegannes/blaine/musical-umbrella-api/node_modules/mongodb-core/lib/connection/pool.js:504:16)\n
at Connection.messageHandler (/Users/bdegannes/blaine/musical-umbrella-api/node_modules/mongodb-core/lib/connection/pool.js:540:5)\n
at emitMessageHandler (/Users/bdegannes/blaine/musical-umbrella-api/node_modules/mongodb-core/lib/connection/connection.js:310:10)\n
at TLSSocket.<anonymous> (/Users/bdegannes/blaine/musical-umbrella-api/node_modules/mongodb-core/lib/connection/connection.js:453:17)\n
at emitOne (events.js:116:13)\n
at TLSSocket.emit (events.js:211:7)\n
at addChunk (_stream_readable.js:263:12)\n
at readableAddChunk (_stream_readable.js:250:11)\n
at TLSSocket.Readable.push (_stream_readable.js:208:10)\n
at TLSWrap.onread (net.js:607:20)',
ok: 0,
errmsg: 'The field \'retryWrites\' is not valid for an index specification. Specification: { name: "findAndLockNextJobIndex", key: { name: 1, nextRunAt: 1, priority: -1, lockedAt: 1, disabled: 1 }, retryWrites: true }',
code: 197,
codeName: 'InvalidIndexSpecificationOption',
operationTime: { _bsontype: 'Timestamp', low_: 1, high_: 1535862308 },
'$clusterTime':
{ clusterTime: { _bsontype: 'Timestamp', low_: 1, high_: 1535862308 },
signature:
{ hash:
{ _bsontype: 'Binary',
sub_type: 0,
position: 20,
buffer:
{ '0': 200,
'1': 60,
'2': 14,
'3': 66,
'4': 111,
'5': 242,
'6': 42,
'7': 102,
'8': 21,
'9': 136,
'10': 115,
'11': 13,
'12': 27,
'13': 71,
'14': 214,
'15': 226,
'16': 181,
'17': 60,
'18': 139,
'19': 16 } },
keyId: { _bsontype: 'Long', low_: 2, high_: 1524496231 } } },
name: 'MongoError' }
Any suggestions?
Same here:
{ MongoError: The field 'retryWrites' is not valid for an index specification. Specification: { name: "findAndLockNextJobIndex", key: { name: 1, nextRunAt: 1, priority: -1, lockedAt: 1, disabled: 1 }, retryWrites: true }
at [...]/node_modules/mongodb-core/lib/connection/pool.js:581:63
at authenticateStragglers ([...]/node_modules/mongodb-core/lib/connection/pool.js:504:16)
at Connection.messageHandler ([...]/node_modules/mongodb-core/lib/connection/pool.js:540:5)
at emitMessageHandler ([...]/node_modules/mongodb-core/lib/connection/connection.js:310:10)
at TLSSocket.<anonymous> ([...]/node_modules/mongodb-core/lib/connection/connection.js:453:17)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at TLSSocket.Readable.push (_stream_readable.js:208:10)
at TLSWrap.onread (net.js:597:20)
operationTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1536145413 },
ok: 0,
errmsg: 'The field \'retryWrites\' is not valid for an index specification. Specification: { name: "findAndLockNextJobIndex", key: { name: 1, nextRunAt: 1, priority: -1, lockedAt: 1, disabled: 1 }, retryWrites: true }',
code: 197,
codeName: 'InvalidIndexSpecificationOption',
'$clusterTime':
{ clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1536145413 },
signature: { hash: [Object], keyId: [Object] } },
name: 'MongoError',
[Symbol(mongoErrorContextSymbol)]: {} }
@simison could you please reopen this issue?
This seems to be related to: https://jira.mongodb.org/browse/NODE-1641
getting this error locally after update agenda version to > @2.0.0
This seems to be related to: https://jira.mongodb.org/browse/NODE-1641
That bug was fixed and will be shipped in v3.1.5 https://github.com/mongodb/node-mongodb-native/pull/1819
Anyone here would like to confirm that upgrading to HEAD or commit 3b725ef667b97a8464ff4693892383b4cc434e92 fixes this?
Once it ships, we just need to update our package-lock.json:
https://github.com/agenda/agenda/blob/759837ca8831c190ed8e043801e8d7bf87c0c927/package.json#L48
Just did a quick check:
git+ssh://[email protected]/mongodb/node-mongodb-nativeBefore doing those steps, I was getting errors on agenda initialization similar to what others have received:
MongoError: The field 'retryWrites' is not valid for an index specification. Specification: { name: "findAndLockNextJobIndex", key: { name: 1, nextRunAt: 1, priority: -1, lockedAt: 1, disabled: 1 }, retryWrites: true }
After doing those steps, I no longer get that error and can initialize agenda. However, as I've just started using agenda, I'm not sure if this upgrade breaks other features.
I'll keep my environment for now, so if there's anything else you'd like me to try, let me know.
Awesome, thanks for the test! Very helpful. It shouldn't break anything.
On Sat, 15 Sep 2018, 05:48 alexmnguyen, notifications@github.com wrote:
Just did a quick check:
- Copied agenda to a local folder.
- Replaced the mongodb dependency with git+ssh://
[email protected]/mongodb/node-mongodb-native- Set local project to use local agenda dependency.
Before doing those steps, I was getting errors on agenda initialization
similar to what others have received:MongoError: The field 'retryWrites' is not valid for an index specification. Specification: { name: "findAndLockNextJobIndex", key: { name: 1, nextRunAt: 1, priority: -1, lockedAt: 1, disabled: 1 }, retryWrites: true }
After doing those steps, I no longer get that error and can initialize
agenda. However, as I've just started using agenda, I'm not sure if this
upgrade breaks other features.I'll keep my environment for now, so if there's anything else you'd like
me to try, let me know.—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/agenda/agenda/issues/686#issuecomment-421525352, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAFUgPoeLHpuQ5hDMNpXrtu1_dL9R7w7ks5ubGp_gaJpZM4WM11M
.
mongodb v3.1.5 (and 3.1.6) have been published.
You all should now be able to just hit npm update to get this fixed since Agenda pins its dependency loosely to "mongodb": "~3.1".
Weird, I am still having the problem with "mongodb": "3.1.6" and "agenda": "2.0.2". Can someone confirm it is working ?
@chris-verclytte it works!