Account Linking Error "Cannot find module 'request@2.56.0'" when Using Node 18
Last Updated:
Overview
This article explains the below error from the Account Linking Extension in a tenant using Node 18:
Cannot find module 'request@2.56.0'
This also triggers a "Failed Login" log in the Auth0 dashboard with the error message.
NOTE: This error gets thrown after a user authenticates and the Account Linking Rule, generated by the extension, is attempting to run.
Applies To
- Node 18
- Account Linking
Cause
The Account Linking Extension uses an older version of the request NPM package which is not compatible with Node 18.
Solution
There are two possible solutions:
- Switch the tenant to Node 16 by going to Settings > Advanced > Extensibility section in the Auth0 dashboard.
- If there is a requirement to keep the tenant on Node 18, then it should be possible to amend the Rule with the changes below:
//var request = require('request@2.56.0'); //Comment this line var queryString = require('querystring'); var Promise = require('native-or-bluebird@1.2.0'); var jwt = require('jsonwebtoken'); //Remove version targetingrequest is embedded in the runtime environment, and jsonwebtoken needs the targeted version removed.