SPFx Application is integrated with graph Api to do crud operations, when end user is connected with vpn its works but without vpn its started throwing the below error {"statusCode":-1,"code":"TypeError","requestId":null,"date":"2025-04-29T13:48:36.433Z","body":"TypeError: Failed to fetch"}.
sharing the piece of code which we are using to get the data with msgraphclient .
it would be helpful if we can get any solution or any other alternate ways to do the call.
import { MSGraphClientFactory, MSGraphClientV3 } from "@microsoft/sp-http";
export class GraphListService {
private static _graphClient: MSGraphClientV3;
public static async Init(msGraphClientFactory: MSGraphClientFactory): Promise<void> {
this._graphClient = await msGraphClientFactory.getClient('3');
}
public static getListItemsByFilter = async (
listId: string,
selectColumns: string,
filter: string,
orderby: string = "",
service
): Promise<any> => {
try {
const data = await this._graphClient
.api(
`/sites/siteid/lists/${listId}/items?expand=fields(select=${selectColumns})&$filter=${filter}&$orderby=${orderby}`).get();
console.log(data, 'res in helper')
} catch (error) {
return console.log("Error getting items by filter from the list", error);
};