Problem statement
This article explains the error “Cannot find module ‘request@2.56.0’,” from the Account Linking Extension in a tenant using Node 18.
This also triggers a ‘failed login’ log in the Auth0 dashboard with the error message as well. Note that this error gets thrown after a user authenticates and the Account Linking Rule, generated by the extension, is attempting to run.
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’s 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 targeting
request
is embedded in the runtime environment, and jsonwebtoken
needs the targeted version removed.