File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
packages/gitbook-v2/src/lib/data Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -579,12 +579,17 @@ export async function apiClient(input: DataFetcherInput = { apiToken: null }) {
579579 let serviceBinding : GitBookAPIServiceBinding | undefined ;
580580
581581 try {
582- const { env } = getCloudflareContext ( ) ;
582+ const { env } = await getCloudflareContext ( { async : true } ) ;
583583 serviceBinding = env . GITBOOK_API ;
584- } catch ( error ) {
585- // IGNORE
586- if ( process . env . NODE_ENV !== 'development' ) {
587- console . warn ( 'Failed to get service binding' , error ) ;
584+ } catch {
585+ try {
586+ const { env } = getCloudflareContext ( ) ;
587+ serviceBinding = env . GITBOOK_API ;
588+ } catch ( error ) {
589+ // IGNORE
590+ if ( process . env . NODE_ENV !== 'development' ) {
591+ console . warn ( 'Failed to get service binding' , error ) ;
592+ }
588593 }
589594 }
590595
You can’t perform that action at this time.
0 commit comments