MetaMask / MetaMask/core

NftController.updateNftMetadata called with too many NFTs at once causes 429 error

Open
#5,047 0 comments 0 reactions 0 assignees View on GitHub
team-assets
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

## Issue
I have about 1949 nfts on base sepolia testnet
using sepolia.base.org as a provider
most of those nfts are testing nfts that have broken images (empty string)
the NftController.updateNftMetadata is beign called with too many nfts at once (see attached images)
## Cause
the issue is caused by using Promise.all to call getNftInformation
https://github.com/MetaMask/core/blob/5d9f45cfa6a2bf8d774302dc3a0bb7ade7dd7a2e/packages/assets-controllers/src/NftController.ts#L1582-L1594

## Proposed Solutions
instead should limit the number of the getNftInformation calls at once
could use one of those packages
https://www.npmjs.com/package/promise-concurrency
https://www.npmjs.com/package/promise-limit
or should only refresh a few broken nfts each time, and keep track of the last updated timestamp

## Images from MetaMask extension service worker on chrome
![Image](https://github.com/user-attachments/assets/ab2ebdea-64d7-428e-bd9e-96500bb5a66c)
![Image](https://github.com/user-attachments/assets/f47b5e30-6c81-4eef-981c-7ddabb06ccd6)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in packages/assets-controllers/src/NftController.ts at lines 1582-1594, where Promise.all calls getNftInformation during updateNftMetadata. Review the surrounding controller flow and determine how concurrent requests should be bounded or refreshed incrementally. Done means large NFT batches no longer trigger provider 429 errors while metadata updates still complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.