Skip to content

fix(settings): load each integration card on its own and open Connect at once - #1783

Merged
gkhngyk merged 4 commits into
ansvisor:mainfrom
cihan-gyk:fix/integrations-loading
Oct 29, 2026
Merged

gkhngyk merged 4 commits into
ansvisor:mainfrom
cihan-gyk:fix/integrations-loading

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Production fix. Customers reported that Settings › Integrations' Connect buttons come very late, and that clicking Connect does nothing.

Root cause: Next.js runs a page's server actions one at a time (next/dist/client/components/app-router-instance.js dispatchAction: a new action waits at the end of the queue).

  • Integrations read each card's status with a server action (getIntegrationStatus, integrations-section.tsx:203-220), and Connect was one too (connectIntegration, use-integration-connect.ts:59).
  • Each status read reaches Composio on the server (server/src/routes/integrations.js:110; the SDK defaults to a 60 s timeout and 2 retries), and the web side had no limit at all.
  • So one slow card (GA, say) held every card behind it, and a Connect click waited behind them all.
  • Measured locally with GA held for 8 s: the four reads went strictly in sequence and Connect opened after 18.5 s. After this fix the reads run in parallel and Connect opens in 0.94 s.
  • fix(shopping): don't ask for Merchant Center where the server doesn't offer it #1747 isn't the cause: /api/integrations/config existed before.

Changes

  • Reads and Connect from the browser: status, Connect and the property lists go through the /api/aeo proxy from the browser (new web/src/lib/integrations-client.ts), so nothing queues behind anything.
    • Limits: 10 s for reads, 20 s for Connect and property lists.
    • Each card shows its own result. On a timeout or error it shows "Try again" with copy from en.json instead of a skeleton.
    • A Connect that can't start says why in a toast. A read-only workspace opens the plan dialog.
  • Google Merchant Center: hidden entirely when this deployment doesn't offer it (product owner's call). The decision comes from the server's env-only /config, and a 404 counts as not offered. No skeleton or "Coming soon" shows while loading.
  • Other cards: the catalog, store, category, Webflow, WordPress and Framer reads get a 10 s limit.
  • Server actions still in use get limits (config 10 s, disconnect 20 s, sync 5 s). Four unused ones are removed.
  • Proxy (own commit): a GET/HEAD the API hasn't started answering within 60 s now gets a 504 with a JSON body (upstream_timeout) instead of hanging (web/src/app/api/aeo/[...path]/route.ts).
  • Rate limit (own commit): the Library's three CMS publish-status reads move to their own limiter (cmsStatusLimiter, 180 per 15 min). Opening the Library no longer uses up the quota that CMS Connect needs.

Not in this PR:

  • Composio's slowness itself. A shorter timeout on the server's Composio client is suggested separately.
  • The Shopping page's _data-strip.tsx still calls three server actions together.
  • The sidebar's double RSC prefetch.

Related issue

None (production bug report).

Type of change

  • fix — Bug fix

How to test

  1. Settings › Integrations: every card shows its own state within a second or two, and none waits for another. With the API stopped, each card shows "Try again" after its limit.
  2. Click Connect on Search Console: Google's consent opens at once.
  3. On a deployment without COMPOSIO_GMC_AUTH_CONFIG_ID, no Merchant Center card shows.
  4. Tests:
    • new: integrations-client.test.ts, actions/integrations.test.ts, the proxy's route.test.ts;
    • updated: integrations-section, use-integration-connect, catalog-sources-card and the server rate-limiter tests.

Screenshots

Checked locally at 1024 px in light and dark mode.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • Web: the 52 related test files (895 tests) pass; typecheck, prettier and eslint clean
  • Server: rate-limiter and content-drafts tests (54) pass; prettier and eslint clean
  • Browser check (1024 px, light and dark)
  • Full suite and build: CI (urgent fix)
  • No migration or env; deploy order doesn't matter (the web works with the current server)

🤖 Generated with Claude Code

cihan-gyk and others added 4 commits October 29, 2026 19:18
Settings › Integrations read every Google card's status, the catalog's
sources and the property lists through server actions. Next runs those one
at a time, so a slow Composio answer for one provider (Analytics) left
Merchant Center and Product catalog on their skeletons behind it, and
Connect, a server action too, queued after them all: measured locally with
Analytics' status held 8 s, the popup opened 18.5 s after the click.

- Status, Connect and the property lists go from the browser through the
  API's proxy (lib/integrations-client.ts), side by side and each with a
  time limit: 10 s for a read, 20 s for Connect and the property lists.
  Connect now opens in under a second while a status is still loading.
- A status that times out or fails says so, with Try again in place of the
  skeleton. A Connect that can't start says why (took too long, admins and
  managers only, or failed) or opens the upgrade dialog.
- Google Merchant Center's card shows only where the server offers it, from
  the API's env-only config: no skeleton and no Coming soon while it isn't,
  and an older API without the config offers nothing.
- The catalog's sources read stops being waited for after 10 s and says it
  can't be read; the store connectors, category pages and Webflow /
  WordPress / Framer reads get the same limit.
- The server actions left (Merchant Center offered, disconnect, the first
  sync, the suggestion sources' config) get time limits; the ones the
  browser calls now are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…with a 504

The same-origin proxy waited on the API without a limit, up to the
function's 300 s, so a hung upstream left a page's cards loading. A GET or
HEAD now gives up after 60 s without an answer and returns a 504 with a
JSON body (code upstream_timeout). Once the API answers, its body streams
through as before; changes keep the long limit the suggestion runs need.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ting a CMS

The Library asks Webflow, WordPress and Framer whether sent pages were
published each time it opens: three requests from cmsLimiter's 60 a
quarter-hour, the bucket connecting a CMS uses too. Opening the Library
often could leave Connect refused with a 429. The three checks get a bucket
of their own (cmsStatusLimiter, 180 a quarter-hour; the server answers them
from a two-minute memory per brand), and cmsLimiter keeps to connections.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. Each integration card loads on its own, the Library's CMS status checks get their own rate-limit bucket (cmsStatusLimiter), and a proxied read gives up after 60 s with a 504 instead of hanging. Conflicts with #1777 in integrations.ts only on the same timeout line; this PR's CONFIG_TIMEOUT_MS is kept. Web typecheck, the settings, integration and proxy tests, and the rate-limiter and content-drafts route tests pass.

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.

2 participants