The Stock Ticker That Worked Everywhere Except Production
My dashboard's stock widget ran flawlessly on localhost and died the moment it hit Vercel. The culprit: Yahoo Finance silently blocks cloud provider IPs.
I wanted a simple stock ticker on my Real-Time Intelligence dashboard: a handful of symbols, current price, a 5-day sparkline, refreshing every 60 seconds. No API key, no paid plan. Yahoo Finance's quote endpoint looked perfect — it worked instantly in local dev. Then I deployed, and every request returned errors. Same code, same endpoint, same headers.
The first lesson came fast: 'works on localhost, fails in production' for an external API almost always means IP reputation, not code. Yahoo's v7 quote endpoint blocks requests originating from cloud provider IP ranges — Vercel, AWS, the lot — and no amount of User-Agent spoofing changes that, because they are not looking at your headers. They are looking at where the packet came from. I burned more time than I want to admit proving this to myself.
The second lesson was about Vercel's edge runtime. My first instinct was to build a multi-source fallback chain with a Finnhub API key as backup, running on the edge for speed. The edge runtime turned out to be too restrictive for API routes calling external services, and the fallback chain was complexity I did not actually want — more keys to manage, more failure modes, more code to maintain for a widget on a portfolio site.
The fix that stuck was simpler than everything I tried before it: Yahoo's v8 chart endpoint (/v8/finance/chart/{symbol}) is not blocked the same way, returns both the quote and the historical points I needed for sparklines in one call, and runs fine on the Node runtime. I deleted the fallback chain, dropped the API key dependency entirely, and the widget has been quietly refreshing every 60 seconds since. Sometimes the senior move is removing code.