Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Bug: guessPotentiallyProxiedOrySdkUrl Returns Wrong SDK Url for Staging (nextJS)

オープン
#572 コメント 12 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
next.js, typescript
領域
frontend, web-dev

調査の方向性

packages/elements-react/src/client/config.ts、特に guessPotentiallyProxiedOrySdkUrl から始め、packages/nextjs/src/app/login.ts からの使用箇所を追跡します。examples/nextjs-app-router で説明されている staging deployment を再現し、NEXT_PUBLIC_ORY_SDK_URL と VERCEL_URL がどのように選択されるかを調査します。staging のログインフローで設定された SDK URL が使用され、production の動作が引き続き正しい状態になれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug
Preflight checklist
Ory Network Project

No response

Describe the bug

I have run into an issue with the ory/nextjs package, specifically the getLoginFlow function:

https://github.com/ory/elements/blob/e159960474eb1351bea86afab6d930f41b4acae6/packages/nextjs/src/app/login.ts#L47

We call this function when a user navigates to the login page of our site.

Under the hood it uses this function to determine the ory SDK Url:
https://github.com/ory/elements/blob/e159960474eb1351bea86afab6d930f41b4acae6/packages/elements-react/src/client/config.ts#L46

In Vercel we have a production and a staging environment. This works fine for our production environment. But in our staging environment the user is sent to the wrong link, e.g. xyz.vercel.app because the logic in this function causes the us to hit this line which sets our sdk url as the incorrect address:

    if (!isProduction() && process.env.VERCEL_URL) {
      return `https://${process.env.VERCEL_URL}`.replace(/\/$/, "")
    }

But we need the request to be directed to the address we set with this variable, even in staging: NEXT_PUBLIC_ORY_SDK_URL

Always very grateful for your help and continued support 🙏

Reproducing the bug
  1. Clone this example project https://github.com/ory/elements/tree/main/examples/nextjs-app-router
  2. Publish to Github
  3. Link the project in vercel and create a project from main branch.
  4. GIve the project an additional custom environment called "staging".
  5. Set the environment variable for each environment NEXT_PUBLIC_ORY_SDK_URL as any value.
  6. The login flow will work for production environment but fail for staging environment, with users being directed to xyz.vercel.app when they initiate a login sequence
Relevant log output

Relevant configuration

Version

1.0.0-rc.0

On which operating system are you observing this issue?

None

In which environment are you deploying?

None

Additional Context

No response

主要言語
TypeScript
スター
188
フォーク
80
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ory/elements のほかの issue

ory/elements の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。