decentraland / decentraland/lamb2

Fix missing idFrom in marketplace fallback pagination

Open Beginner friendly
#474 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
1
Forks
6
Avg merge
1d 7h
Merged PRs (30d)
8

Description

## Description

`WKC_TheGraph_Errors` fired for `catalyst-lamb2-prd` against the collections subgraphs after marketplace-api errors routed requests through lamb2's marketplace fallback path.

The fallback path in `fetchNFTsPaginated` sends the first-page GraphQL query with only `{ owner }`, while the query uses `id_gt: $idFrom`. This can serialize as `idFrom: null`/missing and produce GraphQL error responses from the collections subgraph. The subgraph component retries those errors, multiplying `subgraph_errors_total` and making the alert fire during marketplace-api degradation.

## Expected Behavior

First-page fallback queries should include a valid lower-bound `idFrom` value so `id_gt` is not sent as null/missing.

## Context

From Slack investigation:

- lamb2 calls marketplace-api first for wearables/emotes.
- When marketplace-api fails, `fetchWithMarketplaceFallback` falls back to TheGraph.
- `src/logic/fetch-elements/graph-pagination.ts` passes `{ owner }` without `idFrom` for the first page.
- Sentry showed `Detected error in response body` events where query variables included `owner` but no `idFrom`.
- `@dcl/thegraph-component` retries these errors, increasing `subgraph_errors_total` per affected request.

## Proposed Fix

Pass `idFrom: ''` on the first-page query in `fetchNFTsPaginated`, matching the pagination lower-bound used for subsequent queries and preventing `id_gt` from receiving null/missing values.

Reported by Charly
Requested by Charly (<@U0747ARK5TM>)

Contributor guide

Open the contributing guide

Research direction

Start in src/logic/fetch-elements/graph-pagination.ts at fetchNFTsPaginated and inspect how variables are built for the first-page GraphQL query. Pass the same lower-bound value described in the issue so the first-page request includes idFrom as an empty string, and verify that id_gt is no longer sent as null or missing.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
backend-api-design
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.