Skip to content

fix(web): use backend URL fallback for direct fetches#1212

Merged
Dhravya merged 4 commits into
supermemoryai:mainfrom
GautamSharma99:fix/web-backend-url-fallback
Jul 11, 2026
Merged

fix(web): use backend URL fallback for direct fetches#1212
Dhravya merged 4 commits into
supermemoryai:mainfrom
GautamSharma99:fix/web-backend-url-fallback

Conversation

@GautamSharma99

Copy link
Copy Markdown
Contributor

This fixes several direct web fetches that could build invalid undefined/... URLs when
NEXT_PUBLIC_BACKEND_URL is not configured.

Most of the app already falls back to https://api.supermemory.ai, but a few direct
fetch/router calls skipped that fallback. This PR adds a shared getBackendUrl() helper and
uses it for affected web requests.

Changes

  • Add getBackendUrl() in apps/web/lib/url-helpers.ts

  • Normalize trailing slashes from configured backend URLs

  • Use the fallback URL for:

    • OTP magic-link verification redirect
    • chat thread list/load/delete requests
    • space highlights requests and cache key
    • memory-of-day request
    • file upload request
  • Add tests for default fallback, custom URL, and trailing slash handling

Testing

  • bun test apps/web/lib/url-helpers.test.ts

  • bunx biome check apps/web/lib/url-helpers.ts apps/web/lib/url-helpers.test.ts apps/web/
    components/chat/index.tsx apps/web/components/app-experience.tsx apps/web/hooks/use-
    document-mutations.ts 'apps/web/app/(auth)/login/page.tsx'

  • Verified no remaining unsafe direct interpolations with:

    • rg "NEXT_PUBLIC_BACKEND_URL\}/" -n apps/web

Dhravya and others added 3 commits July 10, 2026 19:33
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Dhravya
Dhravya merged commit 19d7f12 into supermemoryai:main Jul 11, 2026
5 checks passed
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