> ## 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、ルール、フック、Database Scripts、カスタムソーシャル接続が含まれます。コード セキュリティのベストプラクティスに従うため、できるだけ早く Node 22 へ更新することを強くお勧めします。

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

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

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

<div id="marketplace-integrations">
  ### Marketplaceとの連携
</div>

<div id="social-connections-integrations">
  #### Social Connections の連携
</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="/docs/ja-jp/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> では、Marketplace 経由で追加されたカスタムソーシャル接続のスクリプトは更新できません。Node 22 に対応するためにスクリプトの変更が必要な場合は、<Tooltip tip="Management API: お客様が管理タスクを実行できるようにする製品。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Management+API">Management API</Tooltip> を使用する必要があります。
</Note>

<div id="migration-tasks">
  ## 移行作業
</div>

<div id="create-new-custom-actions">
  ### 新しいカスタム Actions を作成する
</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 でカスタム Actions を記述し、テストを行い、準備ができたらデプロイします。

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

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

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

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

* ルール
* フック
* Custom DB スクリプト
* カスタムソーシャル接続スクリプト

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

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

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

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