import axios from "axios" ; import { promises as fs } from "fs" ; const SENTRY_API_SCHEMA_SHA = "9c4c1db4c1ea42184b34b81b467e16ca1b4eb176" ; const activeEnv = process . env . GATSBY_ENV || process . env . NODE_ENV || "development" ; export default async ( ) => { if ( activeEnv === "development" && process . env . OPENAPI_LOCAL_PATH ) { try { console . log ( `Fetching from ${ process . env . OPENAPI_LOCAL_PATH }` ) ; let data = await fs . readFile ( process . env . OPENAPI_LOCAL_PATH , "utf8" ) ; return data ; } catch ( error ) { console . log ( `Failed to connect to  ${ process . env . OPENAPI_LOCAL_PATH }. Continuing to fetch versioned schema from Github.
        ${ error }` ) ; } } const response = await axios . get ( `https://raw.githubusercontent.com/getsentry/sentry-api-schema/${ SENTRY_API_SCHEMA_SHA }/openapi-derefed.json` ) ; return response . data ; } ;