Skip to content

Conversation

@PavelSafronov
Copy link
Contributor

@PavelSafronov PavelSafronov commented Oct 27, 2025

Description

Summary of Changes

As described in https://www.mongodb.com/community/forums/t/mongodb-node-js-driver-vs-aws-lambda-with-provisioned-concurrency/326386, a Node.js writeAfterFIN error can bubble up to the driver.

In NODE-6864, all socket errors were handled to be wrapped in MongoNetworkErrors, however this doesn't appear to be handled.

This change wraps an extra socket.write call in a try-catch block, and adds a test for this scenario.

Release Highlight

Wrap socket write in a try/catch to ensure errors can be properly wrapped

One socket.write call was not correctly wrapped in a try/catch block and network errors could bubble up to the driver. This call is now properly wrapped and will result in a retry.

Double check the following

  • Lint is passing (npm run check:lint)
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
  • Changes are covered by tests

@PavelSafronov PavelSafronov changed the title fix(NODE-7067): Wrap socket write in a try/catch to ensure errors can be properly wrapped feat(NODE-7067): Wrap socket write in a try/catch to ensure errors can be properly wrapped Oct 27, 2025
@PavelSafronov PavelSafronov marked this pull request as ready for review October 27, 2025 20:00
@PavelSafronov PavelSafronov requested a review from a team as a code owner October 27, 2025 20:00
@baileympearson baileympearson self-assigned this Oct 27, 2025
@baileympearson baileympearson added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Oct 27, 2025
@baileympearson baileympearson changed the title feat(NODE-7067): Wrap socket write in a try/catch to ensure errors can be properly wrapped fix(NODE-7067): Wrap socket write in a try/catch to ensure errors can be properly wrapped Oct 28, 2025
@PavelSafronov PavelSafronov merged commit 66c18b7 into mongodb:main Oct 28, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Primary Review In Review with primary reviewer, not yet ready for team's eyes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants