-
Notifications
You must be signed in to change notification settings - Fork 317
Closed
Labels
Description
I am trying to initialize Auth0 ManagementClient in my Lambda function (Node.js + Typescript)
import { ManagementClient } from "auth0";
private getAuth0Client() {
const auth0Domain = process.env.AUTH0_DOMAIN;
const auth0ClientId = process.env.AUTH0_CLIENT_ID;
const auth0ClientSecret = process.env.AUTH0_CLIENT_SECRET;
if(auth0Domain && auth0ClientId && auth0ClientSecret) {
return new ManagementClient({
domain: auth0Domain,
clientId: auth0ClientId,
clientSecret: auth0ClientSecret,
scope: "read:users update:users",
});
} else {
throw new Error("Could not initialize Auth0 Management Client");
}
}
public async getUser(userId: string): Promise<any> {
try {
const auth0Client = this.getAuth0Client();
return await auth0Client.getUser({
id: userId
});
} catch (error) {
console.log(error);
}
}
and it gives me the following error
{
"errorType": "TypeError",
"errorMessage": "E is not a function",
"stack": [
"TypeError: E is not a function",
" at Object.91738 (/var/task/src/sns-lambda.js:94:5226)",
" at ds (/var/task/src/sns-lambda.js:2333:1904531)",
" at Object.59458 (/var/task/src/sns-lambda.js:94:15606)",
" at ds (/var/task/src/sns-lambda.js:2333:1904531)",
" at Object.16135 (/var/task/src/sns-lambda.js:2220:1079)",
" at ds (/var/task/src/sns-lambda.js:2333:1904531)",
" at Object.81557 (/var/task/src/sns-lambda.js:2173:10664)",
" at ds (/var/task/src/sns-lambda.js:2333:1904531)",
" at Object.96781 (/var/task/src/sns-lambda.js:2173:15330)",
" at ds (/var/task/src/sns-lambda.js:2333:1904531)"
]
}
I am using the following versions for auth0
auth0: 3.3.0 and @types/auth0: 2.35.9
I am not sure what I am doing wrong here.
mribichich