From 777632b841aac4c3d53debeaaf7befc23c19e37a Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Mon, 11 Sep 2023 03:28:06 -0700 Subject: [PATCH] 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 --- desktop/flipper-common/src/server-types.tsx | 1 + desktop/flipper-server-core/src/fb-stubs/internRequests.tsx | 2 ++ 2 files changed, 3 insertions(+) diff --git a/desktop/flipper-common/src/server-types.tsx b/desktop/flipper-common/src/server-types.tsx index b8fd38c89..1591ec715 100644 --- a/desktop/flipper-common/src/server-types.tsx +++ b/desktop/flipper-common/src/server-types.tsx @@ -361,6 +361,7 @@ export type FlipperServerCommands = { timeout?: number; internGraphUrl?: string; headers?: Record; + vpnMode?: 'vpn' | 'vpnless'; }, ) => Promise; 'intern-graph-get': ( diff --git a/desktop/flipper-server-core/src/fb-stubs/internRequests.tsx b/desktop/flipper-server-core/src/fb-stubs/internRequests.tsx index eaf81aff6..d811f4ba6 100644 --- a/desktop/flipper-server-core/src/fb-stubs/internRequests.tsx +++ b/desktop/flipper-server-core/src/fb-stubs/internRequests.tsx @@ -21,6 +21,7 @@ export async function internGraphPOSTAPIRequest( timeout?: number; internGraphUrl?: string; headers?: Record; + vpnMode?: 'vpn' | 'vpnless'; }, token: string, ): Promise { @@ -36,6 +37,7 @@ export async function internGraphGETAPIRequest( timeout?: number; internGraphUrl?: string; headers?: Record; + vpnMode?: 'vpn' | 'vpnless'; }, token: string, ): Promise {