GPT-5 finding
Potential runtime incompatibility: use of Array.prototype.toSorted in Node.js route
mediummaintainabilitymedium
- apps/web/app/receipts.rss/route.ts:47-49
Array.prototype.toSorted is a relatively new addition (ES2023) and is not available on Node.js 18, which is still common in Next.js deployments unless explicitly set to Node 20+. Next.js does not polyfill built-in prototype methods on the server runtime. If this route executes on a Node < 20 runtime, it will throw TypeError: items.toSorted is not a function, breaking the RSS endpoint.
Recommendation
Replace toSorted with a backward-compatible pattern that does not mutate input: - const items = [...sameRepoItems, ...crossRepoItems].sort((a, b) => b.pubDate.getTime() - a.pubDate.getTime()); This works on all supported Node versions and preserves the non-mutating intent by sorting a copy.