Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Route Handler request always return "n" instead of the worker's origin #210

Open
quanphung1120 opened this issue Dec 27, 2024 · 0 comments
Labels
bug Something isn't working triage

Comments

@quanphung1120
Copy link

quanphung1120 commented Dec 27, 2024

Describe the bug

export async function GET(
  request: NextRequest,
  { params }: { params: Promise<{ provider: string }> }
) {
  const url = new URL(request.nextUrl);
  const supabase = await createClient();
  const provider = (await params).provider as Provider;

  console.log("raw url: " + request.nextUrl);
  console.log("url: " + url);
  const { data, error } = await supabase.auth.signInWithOAuth({
    provider,
    options: {
      redirectTo: `${url.origin}/auth/callback`,
    },
  });

  console.log(`${url.origin}/auth/callback`);

  if (error || !data || !data.url) {
    return Response.json({ msg: "Failed to sign in" }, { status: 500 });
  }

  return redirect(data.url);
}

image

request.nextUrl always return "https://n/" instead of my worker custom domain.

Steps to reproduce

Create a route handler and call request.nextUrl

Expected behavior

It should return the correct url

@opennextjs/cloudflare version

0.3.2

Wrangler version

3.99.0

next info output

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 7782
  Available CPU cores: 32
Binaries:
  Node: 20.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.4.0
Relevant Packages:
  next: 15.1.3 // Latest available version is detected (15.1.3).
  eslint-config-next: 15.1.3
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: N/A

Additional context

No response

@quanphung1120 quanphung1120 added bug Something isn't working triage labels Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant