I’m implementing Lemon Squeezy webhooks in my Next.js application deployed on Vercel. When a webhook is triggered, my endpoint needs to fetch price data from the Lemon Squeezy API. Here’s the exact flow:
- A Lemon Squeezy webhook calls my route endpoint
- This endpoint calls a function
updateSubscription - Inside
updateSubscription, there’s a call togetSubscriptionPricewhich fetches price data fromhttps://api.lemonsqueezy.com/v1/prices/{price_id}
The issue is that this API call silently fails in the Vercel production environment, but works perfectly in my local development environment. To debug this:
- I verified that my fetch implementation works by successfully calling other APIs (like JSONPlaceholder) from the same Vercel function
- I confirmed that the API key is correctly set in Vercel’s environment variables
- The exact same code works when running locally
The request doesn’t return any error - it simply stops executing after attempting to fetch from the Lemon Squeezy API. This suggests there might be some IP-based blocking or networking issue between Vercel’s serverless functions. Can someone help?