fix: RPC request with id already seen error when using firefox #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using
@metamask/connectin the Firefox Extension, when the dapp side disconnects, the UI updates correctly, but attempting to reconnect does not prompt the wallet pop-up for permission granting.This happens because createDupeReqFilterStream middleware is responsible for keeping track of IDs that have been recently seen and not respond to request incoming from these matching IDs.
On disconnect, calling
getUniqueIdfunction once at the beginning ofwindowPostMessageTransportwas not enough to make sure we avoid repeated IDs, so the proposed fix here is to make sure we call it on each individual request, guaranteeing the unique requests make it through.Screenshots/Recordings
Before
Screen.Recording.2025-12-03.at.11.43.05.mov
After
Screen.Recording.2025-12-04.at.12.37.40.mov
Note
Use getUniqueId for every windowPostMessageTransport request to avoid duplicate RPC IDs (Firefox), and document in CHANGELOG.
src/transports/windowPostMessageTransport.ts: Generate a newidviagetUniqueId()for eachrequest, replacing the incremented counter to prevent duplicate RPC IDs.CHANGELOG.md: Add Unreleased entry under Fixed describing the per-requestgetUniqueIdchange and associated Firefox duplicate ID issue.Written by Cursor Bugbot for commit d1b49ef. This will update automatically on new commits. Configure here.