parse-server: MongoError: Transaction numbers are only allowed on storage engines that support document-level locking

I updated my parse server installation to version 3.8.0. I first got this error in the logs:

MongoError: This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.

This was of course an easy fix and the error went away after adding the option to my connection string.

Now I see another error for queries to the database:

2019-08-27T07:44:31.538322+00:00 app[web.1]: MongoError: Transaction numbers are only allowed on storage engines that support document-level locking
2019-08-27T07:44:31.538354+00:00 app[web.1]: at Connection.<anonymous> (/app/node_modules/mongodb/lib/core/connection/pool.js:466:61)
2019-08-27T07:44:31.538359+00:00 app[web.1]: at emitTwo (events.js:126:13)
2019-08-27T07:44:31.538360+00:00 app[web.1]: at Connection.emit (events.js:214:7)
2019-08-27T07:44:31.538361+00:00 app[web.1]: at processMessage (/app/node_modules/mongodb/lib/core/connection/connection.js:364:10)
2019-08-27T07:44:31.538362+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongodb/lib/core/connection/connection.js:533:15)
2019-08-27T07:44:31.538363+00:00 app[web.1]: at emitOne (events.js:116:13)
2019-08-27T07:44:31.538364+00:00 app[web.1]: at Socket.emit (events.js:211:7)
2019-08-27T07:44:31.538365+00:00 app[web.1]: at addChunk (_stream_readable.js:263:12)
2019-08-27T07:44:31.538369+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:250:11)
2019-08-27T07:44:31.538370+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:208:10)
2019-08-27T07:44:31.538371+00:00 app[web.1]: at TCP.onread (net.js:601:20)

I tried to find information on this issue myself and I think this is caused by my older MongoDB Server version. It currently runs 3.6.11 which does not support this feature.

I have not seen this issue on older releases of parse server. Any other config I need to change to make this work? Or is MongoDB 4 required for parse server now?

  • Server

    • parse-server version: 3.8.0
    • Operating System: heroku-18 stack
    • Localhost or remote server? Heroku
  • Database

    • MongoDB version: 3.6.11
    • Localhost or remote server? mlab

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (14 by maintainers)

Commits related to this issue

Most upvoted comments

+1 I had this error until I added retryWrites=false to my database uri.

I feel very bad right now because I made an obvious mistake!

I appended ?retryWrites=false to the URI. However this is wrong as there is already the replicaSet parameter and therefore I need to append &retryWrites=false to make it work correctly.

So this is how it looks right now:

[...]?replicaSet=rs-ds00000?retryWrites=false

Working perfectly without any errors.

Thanks for all your help and patience.

Don’t forget to quote the URL if setting this on Heroku. So do:

heroku config:set MONGODB_URI="mongodb://…&retryWrites=false"

with the double quotes. Otherwise the “&” will trip you up.

I’ve just taken a closer look in the MongoDB docs to understand the reasons. So let’s go:

  • In the last release of Parse Server, 3.8, we’ve upgraded our MongoDB driver to its latest version v3.3.0;
  • According to the MongoDB driver v3.3.0 release notes, it is now compatible with the MongoDB v4.2;
  • Looking at Retryable Writes documentation, it says that:

The official MongoDB 4.2-compatible drivers enable Retryable Writes by default. Applications upgrading to the 4.2-compatible drivers that require retryable writes may omit the retryWrites=true option. Applications upgrading to the 4.2-compatible drivers that require disabling retryable writes must include retryWrites=false in the connection string.

So, yes. If you are running your Parse Server on top of a MongoDB deployment which does not fit the Retryable Writes Requirements, you will have to add retryWrites=false to your connection string in order to upgrade to Parse Server 3.8.

@mtrezza I think it is worth to mention that in the release notes. Do you want to open a PR with this?

you could paste it here for us to dissect - take care to remove the hostname and authorisation details like so: mongodb://xx:xx@xx.com:33427,xx.com:33427/database-name?replicaSet=rs-xx&ssl=true&retryWrites=false