Skip to content

fix: move token price chart proxy from bff to cow fi#7009

Closed
kernelwhisperer wants to merge 1 commit intodevelopfrom
fix/cow-fi-token-proxy
Closed

fix: move token price chart proxy from bff to cow fi#7009
kernelwhisperer wants to merge 1 commit intodevelopfrom
fix/cow-fi-token-proxy

Conversation

@kernelwhisperer
Copy link
Copy Markdown
Contributor

@kernelwhisperer kernelwhisperer commented Feb 13, 2026

Summary

Fixing https://nomevlabs.slack.com/archives/C0361CDG8GP/p1769437579528819
image

Summary by CodeRabbit

  • Refactor

    • Enhanced token data request handling through optimized backend infrastructure, improving reliability and performance for token pricing and market data services.
  • Chores

    • Simplified environment configuration by updating API endpoint management approach.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cowfi Ready Ready Preview Feb 13, 2026 9:28am
explorer-dev Ready Ready Preview Feb 13, 2026 9:28am
sdk-tools Ready Ready Preview Feb 13, 2026 9:28am
swap-dev Ready Ready Preview Feb 13, 2026 9:28am
widget-configurator Ready Ready Preview Feb 13, 2026 9:28am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cosmos Ignored Ignored Feb 13, 2026 9:28am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 13, 2026

Walkthrough

This PR replaces an external AWS API endpoint with an internal Next.js API proxy route. A new /api/proxies/tokens endpoint forwards GraphQL requests to Uniswap, the Apollo client configuration is updated to use this internal proxy, and the external environment variable is removed.

Changes

Cohort / File(s) Summary
API Proxy Route
apps/cow-fi/app/api/proxies/tokens/route.ts
New POST handler that forwards incoming request bodies to Uniswap GraphQL API, maintaining original content-type headers and setting custom origin/referer headers.
Configuration Updates
apps/cow-fi/services/uniswap-price/apollo-client.ts, apps/cow-fi/.env
Replaced external AWS API endpoint reference with hardcoded internal proxy path /api/proxies/tokens and removed NEXT_PUBLIC_AWS_API_ENDPOINT environment variable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • shoom3301
  • elena-zh
  • limitofzero

Poem

🐰 A proxy so neat, internal and tidy,
No more external calls on a whim,
We forward our tokens with hop-hop precision,
Through tunnels of code, neat and slim! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete and lacks required sections. It only contains a Summary heading with a Slack link reference and an image, but is missing the 'To Test' section with testing steps and verification checkboxes, and the 'Background' section. Add 'To Test' section with numbered steps and verification checkboxes, and optionally a 'Background' section explaining why this change was necessary and how it improves the system.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving the token price chart proxy endpoint from an external BFF service to an internal cow.fi API route.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into develop

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/cow-fi-token-proxy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/cow-fi/app/api/proxies/tokens/route.ts`:
- Around line 9-18: The upstream fetch to UNISWAP_GRAPHQL_URL (the call
assigning upstreamResponse) lacks timeout and error handling; wrap the fetch in
a try/catch and use the shared timeout helper (prefer import of withTimeout or
fetchWithTimeout from `@cowprotocol/common-utils`) to abort slow requests, falling
back to AbortSignal.timeout() if the helper isn't available, and on errors
return a controlled Response (with appropriate status and message) instead of
letting the exception bubble; ensure headers/body/cache usage remains the same
and reference the existing upstreamResponse fetch call when implementing the
change.
🧹 Nitpick comments (1)
apps/cow-fi/app/api/proxies/tokens/route.ts (1)

3-4: Origin spoofing is fragile — document the reason and risk.

Spoofing Origin and Referer to impersonate app.uniswap.org works today but will silently break if Uniswap tightens validation (e.g., API keys, IP-based rate limits, additional header checks). A brief comment documenting why this is necessary and the associated risk would help future maintainers.

Comment thread apps/cow-fi/app/api/proxies/tokens/route.ts
@kernelwhisperer kernelwhisperer requested a review from a team February 13, 2026 10:22
Copy link
Copy Markdown
Contributor

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works!

@kernelwhisperer
Copy link
Copy Markdown
Contributor Author

Closing in favor of cowprotocol/bff#202

@github-actions github-actions Bot locked and limited conversation to collaborators Feb 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants