Skip to content

Fix OpenRouter FX lookups and the Vercel charges end date - #22

Open
HerveZu wants to merge 1 commit into
lobbystack:mainfrom
HerveZu:fix/openrouter-fx-date-vercel-end
Open

HerveZu wants to merge 1 commit into
lobbystack:mainfrom
HerveZu:fix/openrouter-fx-date-vercel-end

Conversation

@HerveZu

@HerveZu HerveZu commented Nov 9, 2026

Copy link
Copy Markdown

Two connector errors seen on openprofit.dev with a CHF workspace.

OpenRouter: FX USD→CHF 2026-11-08 00:00:00: 404

OpenRouter's /activity returns date as "2026-11-08 00:00:00". activityLines used it as the line date, so rateFor built https://api.frankfurter.dev/v1/2026-11-08 00:00:00?..., which 404s (/v1/2026-11-08 answers fine). Every workspace whose base currency isn't USD fails the sync and shows $0 for OpenRouter.

Lines now take r.date.slice(0, 10). externalId is left as it was, so existing lines from USD workspaces are updated in place rather than duplicated.

Vercel: Vercel returned an error (400).

fetchCosts set the exclusive to to midnight UTC after range.to, which is today, so every sync asked for charges up to tomorrow. The end is now capped at the start of the current UTC day (to is exclusive and day-granular per the endpoint docs). Today's partial day comes with the next sync, which rereads the last 3 days.

I couldn't see Vercel's response body (the UI shows the generic sentence), so the future to being the cause of the 400 is my best reading of the request rather than something confirmed against the API.

Checks

  • biome check passes on both files
  • Not run against live accounts

🤖 Generated with Claude Code

OpenRouter's activity API dates each row as "2026-11-08 00:00:00". The
connector passed that through as the line date, so the sync asked
Frankfurter for /v1/2026-11-08 00:00:00, got a 404, and the connection
errored for any workspace not in USD. Lines now carry the day alone;
externalIds are unchanged, so stored lines are updated, not duplicated.

Vercel's billing charges request ended at midnight after today, a
moment in the future, and the connection failed with a 400. The end is
now capped at the start of the current UTC day; today's charges come
with the next sync, which rereads the last 3 days.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant