authentication - Clerk Development Mode Redirect Error with Next.js and Cloudflare Worker Proxy - Stack Overflow

I'm encountering a specific development mode error with Clerk authentication when using a Cloudfla

I'm encountering a specific development mode error with Clerk authentication when using a Cloudflare Worker as a proxy. The application automatically redirects to:

https://[my-worker-url].workers.dev/clerk/v1/client/handshake?redirect_url=http%3A%2F%2Flocalhost%3A3000%2F&suffixed_cookies=false&_clerk_hs_reason=dev-browser-missing

The key issue is the __clerk_hs_reason=dev-browser-missing parameter, which seems to indicate a problem with Clerk's development browser session.

Error Message is :

{
    "errors": [{
        "message": "is invalid",
        "long_message": "http://localhost:3000/ does not match one of the allowed values for parameter redirect_url",
        "code": "form_param_value_invalid",
        "meta": {
            "param_name": "redirect_url"
        }
    }]
}

.env.local:

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_***
NEXT_PUBLIC_CLERK_PROXY_URL=https://[my-worker-url].workers.dev/__clerk
CLERK_SECRET_KEY=sk_test_***
NEXT_PUBLIC_CLERK_IS_DEVELOPMENT=true
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
NEXT_PUBLIC_APP_URL=http://localhost:3000


 Specific Issues
1. The `dev-browser-missing` error suggests Clerk can't establish a development session
2. The redirect URL validation fails despite being in development mode
3. There's no option in the Clerk Dashboard to configure allowed redirect URLs

 What I've Tried
1. Set `NEXT_PUBLIC_CLERK_IS_DEVELOPMENT=true`
2. Configured the Cloudflare Worker to handle development mode:
   - Added development headers
   - Handled redirect URL validation
   - Set up proper CORS headers
3. Cleared all browser data and Next.js cache
4. Verified test API keys are being used


1. How can I properly handle the `dev-browser-missing` error in the Cloudflare Worker?
2. What's the correct way to configure Clerk's development mode when using a proxy?
3. Are there specific headers or parameters needed for development mode to work with a proxy?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744304901a4567680.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信