Skip to content

fix(clerk-js): Respect proxyUrl and domain in non-browser environments#8095

Open
brkalow wants to merge 1 commit intomainfrom
brk.fix/proxy-url-non-browser
Open

fix(clerk-js): Respect proxyUrl and domain in non-browser environments#8095
brkalow wants to merge 1 commit intomainfrom
brk.fix/proxy-url-non-browser

Conversation

@brkalow
Copy link
Member

@brkalow brkalow commented Mar 17, 2026

Description

It's possible for non-browser environments to provide a domain or proxyUrl, but clerk-js currently ignores the provided values when not in a browser. This PR updates clerk-js so the provided value is now respected in non-browser environments.

The only caveat is that we cannot accept a function for the value in expo, as we are unable to provide the current base URL (window.location.href).

fixes AIE-644

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • Added support for configuring proxy URLs and custom domains in non-browser environments.
  • Bug Fixes

    • Enhanced validation to ensure proxy URLs are absolute HTTP(S) URLs in native environments.
    • Improved error handling when domain or proxy URL configurations are provided as functions in non-browser contexts.
  • Tests

    • Expanded test coverage for non-browser runtime configuration scenarios.

@vercel
Copy link

vercel bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Mar 17, 2026 3:16am

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2026

🦋 Changeset detected

Latest commit: 870b2b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@clerk/clerk-js Patch
@clerk/shared Patch
@clerk/expo Patch
@clerk/chrome-extension Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/localizations Patch
@clerk/msw Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/react Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/ui Patch
@clerk/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 17, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@8095

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8095

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8095

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8095

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8095

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8095

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8095

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8095

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8095

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8095

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8095

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8095

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8095

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8095

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8095

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8095

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8095

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8095

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8095

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8095

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8095

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8095

commit: 870b2b9

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

This change adds support for proxyUrl and domain configuration in non-browser environments for Clerk packages. The modifications include: adding validation logic for proxyUrl in native runtimes to ensure absolute URLs, implementing getter methods in Clerk.ts that handle function-type values by logging warnings and returning empty strings in non-browser contexts, introducing a new assertValidProxyUrl utility function for runtime checks, adding warning messages for unsupported function-type properties, and extending test coverage to verify correct baseUrl resolution behavior in non-browser runtimes when domain or proxyUrl are configured.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: making clerk-js respect proxyUrl and domain configuration in non-browser environments, which is the primary objective of this PR.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant