Hi, I am trying to use the NodeJS package but it’s giving an error with no resolution found.
This is the basic code:
import { ManagementClient } from "auth0";
export const management = new ManagementClient({
domain: ...,
clientId: ...,
clientSecret: ...,
});
import { management } from "@/lib/auth0Client";
import { NextRequest, NextResponse } from "next/server";
export async function GET(req: NextRequest) {
try {
const data = await management.users.get({ id: "105277673537276314057" });
console.log(data);
return NextResponse.json({ ok: true });
} catch (e) {
console.log(e);
return NextResponse.json({ ok: false });
}
}
But it returns an error with this message: “The request failed and the interceptors did not return an alternative response”
Hi @office2
Welcome to the Auth0 Community!
Thank you for posting your question,
Can you confirm for me that your domain, clientID and clientSecret are correct and match those provided in the Auth0 Dashboard and your application has permissions to access this user information?
Thanks
Dawid
For me,
I was adding “https://” as part of domain name when passing it to the ManagementClient
constructor and it was causing the issue. Try removing that and try again.
1 Like
This error has many causes, but in some cases, it can be caused by a slow or high latency internet connection. I suggest running a speed test to see if your connection is slow. In my case, I was on a 1Mbps connection with 60ms of latency. Moving to a faster connection fixed the issue for me. If you are not able to move to a faster connection, try increasing the delay between requests to the Auth0 APIs, as that will often fix the issue.