Add logging and fallback for failing vpnless requests

Summary:
If a requests fails due to lack of allow-listing or other incompatibilities, we will now fall back to VPN mode while logging an error that will hopefully end up at the plugin owner.

For this, there's a new `vpnMode` option on every request that can also be used to enforce a particular type.

There's a lot of verbose logging that's turned off by default but very handy when debugging. Also potentially useful for plugin authors that are looking into request issues.

Reviewed By: lblasa

Differential Revision: D49023365

fbshipit-source-id: 755393063e379587feda9ae13973877780a1d987
This commit is contained in:
Pascal Hartig
2023-09-11 03:28:06 -07:00
committed by Facebook GitHub Bot
parent 2ad789d14e
commit 777632b841
2 changed files with 3 additions and 0 deletions

View File

@@ -361,6 +361,7 @@ export type FlipperServerCommands = {
timeout?: number;
internGraphUrl?: string;
headers?: Record<string, string | number | boolean>;
vpnMode?: 'vpn' | 'vpnless';
},
) => Promise<GraphResponse>;
'intern-graph-get': (

View File

@@ -21,6 +21,7 @@ export async function internGraphPOSTAPIRequest(
timeout?: number;
internGraphUrl?: string;
headers?: Record<string, string | number | boolean>;
vpnMode?: 'vpn' | 'vpnless';
},
token: string,
): Promise<GraphResponse> {
@@ -36,6 +37,7 @@ export async function internGraphGETAPIRequest(
timeout?: number;
internGraphUrl?: string;
headers?: Record<string, string | number | boolean>;
vpnMode?: 'vpn' | 'vpnless';
},
token: string,
): Promise<GraphResponse> {