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

fix: Prevent MongoDB client promise being cached #66977

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

aldosch
Copy link
Member

@aldosch aldosch commented Jun 18, 2024

What?

Update to examples/with-mongodb to incorporate fix from the MongoDB team. This should prevent intermittent serverless function timeouts due to cached promise.

Why?

Vercel users reported intermittent 500 errors when connecting to their MongoDB Atlas clusters in production environments.

Full bug report: NODE-6179

Related issues:

How?

Solution by @baileympearson – thank you 🖤

View commit in mongodb-developer/nextjs-with-mongodb


@aldosch aldosch requested review from a team as code owners June 18, 2024 06:49
@aldosch aldosch requested review from jh3y and molebox and removed request for a team June 18, 2024 06:49
@ijjk ijjk added the examples Issue/PR related to examples label Jun 18, 2024
@ijjk
Copy link
Member

ijjk commented Jun 18, 2024

Allow CI Workflow Run

  • approve CI run for commit: b537753

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

1 similar comment
@ijjk
Copy link
Member

ijjk commented Jun 18, 2024

Allow CI Workflow Run

  • approve CI run for commit: b537753

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@aldosch
Copy link
Member Author

aldosch commented Jun 18, 2024

This change also needs to be applied to vercel/mongodb-starter. Although there may be an issue due to Auth.js (or NextAuth in this case) where MongoDBAdapter expects client: Promise<MongoClient> rather than client: MongoClient.

More context in this work in progress commit.

@aldosch
Copy link
Member Author

aldosch commented Jun 18, 2024

Also, if there is a more appropriate comment to add here please feel free to adjust. I removed it as I was unsure whether its still possible to use another database in a similar way.

@timneutkens timneutkens added the CI approved Approve running CI for fork label Jun 18, 2024
@timneutkens timneutkens merged commit 86dbcbe into canary Jun 18, 2024
34 of 38 checks passed
@timneutkens timneutkens deleted the aldosch/do-not-cache-mongoClient-promise branch June 18, 2024 07:47
@samcx samcx removed the CI approved Approve running CI for fork label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants