question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The types of 'options.autoEncrypter' are incompatible

See original GitHub issue
  • I’m submitting a … [ ] bug report [x] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project

  • Summary

When upgrading the mongodb dependency from 4.1.0 to 4.1.1 this is the TypeScript error:

Type 'import(".../node_modules/mongodb/mongodb").MongoClient' is 
not assignable to type 
'import(".../node_modules/connect-mongo/node_modules/mongodb/mongodb").MongoClient'.
  The types of 'options.autoEncrypter' are incompatible between these types.
    Type 'import(".../node_modules/mongodb/mongodb").AutoEncrypter |
     undefined' is not assignable to type 
     'import(".../node_modules/connect-mongo/node_modules/mongodb/mongodb").AutoEncrypter |
      undefined'.

I think that the fix is as simple as upgrading the dependency in package.json: https://github.com/jdesboeufs/connect-mongo/blob/3e273764c2b88da072a1eb2394ae70b5af158623/package.json#L62

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
rfox12commented, Aug 26, 2021

If mongodb is abiding by good semver citizenship (which I think they will), the promise with minor and patch releases is that they do not break the interface…

I’ve added a pull request.

0reactions
rfox12commented, Sep 18, 2021

@huineng You’ll simply want to ensure mongodb is in your package.json dependencies.
npm install mongodb or yarn install mongodb

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to use the mongo types used by mongoose in my code?
Types of property 'autoEncrypter' are incompatible. Type ... The types of 'options.credentials' are incompatible between these types.
Read more >
Fix issue with OptionalId in typescript 4.5 - MongoDB Jira
NODE-3224autoEncryption with username password in connection string uri produces warning options credentials is not supported.
Read more >
MongoDB PHP Extension 1.12.0 Released
The PHP team is happy to announce that version 1.12.0 of the mongodb PHP extension is now available on PECL. Release Highlights.
Read more >
mongo - Go Packages
Package mongo provides a MongoDB Driver API for Go. Basic usage of the driver starts with creating a Client from a connection string....
Read more >
mongodb | Yarn - Package Manager
... encryption: do not attempt to merge autoEncryption options (e27fdf9) ... for Db.connect removed as not compatible with autodetection of Mongo type ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found