> ## Documentation Index
> Fetch the complete documentation index at: https://translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Node.js 18 の影響を受ける Auth0 Actions 項目について説明します

# Node 18 から Node 22 への移行

2025 年 1 月 15 日時点で、Node 22 の拡張機能ランタイムが、拡張機能関連の提供機能全体で一般提供 (GA) となりました。これには、Actions、Rules、Hooks、Database Scripts、Custom ソーシャル接続 が含まれます。コード セキュリティのベストプラクティスに従うため、できるだけ早く Node 22 に更新することを強く推奨します。

<Warning>
  Actions 内のモジュールレベルのコードは、各 Action のインスタンスごとに 1 回だけ実行され、必要に応じて複数の実行で再利用される場合があります。
</Warning>

<div id="general-considerations">
  ### 一般的な考慮事項
</div>

* 新しいランタイムで利用可能なモジュールについては、[Can I require: Auth0 Extensibility](https://auth0-extensions.github.io/canirequire/) を参照してください。
* `use npm` ディレクティブは、Node 22 では利用できなくなりました。
* ファイルシステムへの書き込みは無効化されています。

<div id="marketplace-integrations">
  ### Marketplace の統合
</div>

<div id="social-connections-integrations">
  #### ソーシャル接続の統合
</div>

Node ランタイムのバージョン変更の影響を受けるソーシャル接続の完全な一覧を特定するには、[Management API](https://auth0.com/docs/api/management/v2) を使用します。特に、カスタムソーシャル接続として明示的に作成されたもの、または Marketplace 経由で最初に追加されたものを含め、影響を受ける可能性があるすべてのソーシャル接続では、`strategy` 属性の値が `oauth1` または `oauth2` のいずれかです。

その後、指定したテナント内の既存のすべてのカスタムソーシャル接続を、[GET all connections](https://auth0.com/docs/api/management/v2#!/Connections/get_connections) エンドポイントを使用してページネーションしながら取得できます。たとえば、次のクエリオプションを使用すると、最大 100 件のカスタムソーシャル接続の名前と識別子が返されます。

```http wrap lines theme={null}
/api/v2/connections?strategy=oauth1&strategy=oauth2&include_totals=true&fields=name&per_page=100
```

<Note>
  <Tooltip tip="Auth0 Dashboard: サービスを設定するための Auth0 の主要製品です。" cta="用語集を表示" href="/ja/docs/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> では、Marketplace 経由で追加したカスタムソーシャル接続のスクリプトは更新できません。Node 22 に対応させるためにスクリプトの変更が必要な場合は、<Tooltip tip="Management API: お客様が管理タスクを実行するための製品です。" cta="用語集を表示" href="/ja/docs/glossary?term=Management+API">Management API</Tooltip> を使用する必要があります。
</Note>

<div id="migration-tasks">
  ## 移行タスク
</div>

<div id="create-new-custom-actions">
  ### 新しいカスタム Action を作成する
</div>

Auth0 Dashboard で Node 22 を使用して新しいカスタム Action を作成するには、次の手順に従います。

1. [Auth0 Dashboard > Actions > Library](https://manage.auth0.com/#/dashboard/actions/library) に移動します。
2. **Create Action > Build from scratch** を選択します。
3. **Runtime**\* フィールドで、**Node 22 (Recommended)** を選択します。
4. Node 22 でカスタム Action を作成し、テストを実行して、準備ができたらデプロイします。

<div id="upgrade-existing-custom-actions">
  ### 既存のカスタム Actions をアップグレードする
</div>

Node 12、16、または 18 で構築された既存のカスタム Actions は、個別に Node 22 へアップグレードできます。また、古いランタイムを使用する[以前のバージョンに戻す](/ja/docs/customize/actions/manage-versions#revert-actions)こともできます。Actions を Node 22 にアップグレードするには、必要な変更を加えた既存実装の新しいバージョンを作成してデプロイし、ランタイムとして Node 22 を使用するように設定します。

<div id="choose-node-22-for-other-extensibility-products">
  ### その他の拡張機能製品では Node 22 を選択する
</div>

残りの (Actions 以外の) 拡張機能で使用されるランタイムは、テナントの高度な設定でグローバルに定義されます。この設定を変更すると、次の機能に同時に影響します。

* Rules
* Hooks
* カスタムデータベーススクリプト
* カスタムソーシャル接続スクリプト

Auth0 Dashboard でテナントの拡張機能ランタイム設定を変更するには、次の手順を実行します。

1. **Dashboard > Settings > Advanced** に移動します。
2. **Extensibility** セクションまでスクロールします。
3. **Runtime** で **Node 22** を選択します。
4. **Legacy Extensibility** で、該当する場合は Runtime のバージョンを選択します。

これは複数の拡張機能に同時に影響するグローバル設定であるため、まず開発テナントでこの手順を実行し、該当するすべての拡張機能のテストを完了してから、開発環境で問題がないことを確認したうえで本番テナントに進むことを推奨します。

特に Custom DB スクリプトについては、グローバルな Runtime バージョンの変更を行う前に、[このページで説明されている手順に従って](/ja/docs/authenticate/database-connections/custom-db/custom-database-connections-scripts/environment)、特定の Runtime バージョンに対してスクリプトを個別に検証できます。
