@@ -63,21 +63,33 @@ const getFileSystemEdgeConfig = trace(
6363 connection : Connection ,
6464 ) : Promise < EmbeddedEdgeConfig | null > {
6565 // can't optimize non-vercel hosted edge configs
66- if ( connection . type !== 'vercel' ) return null ;
66+ if ( connection . type !== 'vercel' ) {
67+ // eslint-disable-next-line -- debugging
68+ console . log ( 'getFileSystemEdgeConfig: skipping non-vercel' ) ;
69+ return null ;
70+ }
6771 // can't use fs optimizations outside of lambda
68- if ( ! process . env . AWS_LAMBDA_FUNCTION_NAME ) return null ;
72+ if ( ! process . env . AWS_LAMBDA_FUNCTION_NAME ) {
73+ // eslint-disable-next-line -- debugging
74+ console . log ( 'getFileSystemEdgeConfig: skipping non-lambda' ) ;
75+ return null ;
76+ }
6977
7078 try {
7179 const content = await readFileTraced (
7280 `/opt/edge-config/${ connection . id } .json` ,
7381 'utf-8' ,
7482 ) ;
7583
84+ // eslint-disable-next-line -- debugging
85+ console . log ( 'getFileSystemEdgeConfig: readFileTraced' ) ;
7686 return cachedJsonParseTraced (
7787 connection . id ,
7888 content ,
7989 ) as EmbeddedEdgeConfig ;
8090 } catch {
91+ // eslint-disable-next-line -- debugging
92+ console . log ( 'getFileSystemEdgeConfig: error -> null' ) ;
8193 return null ;
8294 }
8395 } ,
@@ -107,9 +119,13 @@ const getPrivateEdgeConfig = trace(
107119 typeof privateEdgeConfig === 'object' &&
108120 typeof privateEdgeConfig . get === 'function'
109121 ) {
122+ // eslint-disable-next-line -- debugging
123+ console . log ( 'getPrivateEdgeConfig: using privateEdgeConfig from symbol' ) ;
110124 return privateEdgeConfig . get ( connection . id ) ;
111125 }
112126
127+ // eslint-disable-next-line -- debugging
128+ console . log ( 'getPrivateEdgeConfig: skipping' ) ;
113129 return null ;
114130 } ,
115131 {
@@ -142,10 +158,20 @@ function createGetInMemoryEdgeConfig(
142158
143159 return trace (
144160 ( localOptions ) => {
145- if ( localOptions ?. consistentRead || ! shouldUseDevelopmentCache )
161+ // eslint-disable-next-line -- debugging
162+ console . log ( `getInMemoryEdgeConfig: called` ) ;
163+ if ( localOptions ?. consistentRead || ! shouldUseDevelopmentCache ) {
164+ // eslint-disable-next-line -- debugging
165+ console . log ( 'getInMemoryEdgeConfig: skipping' , {
166+ localOptions,
167+ shouldUseDevelopmentCache,
168+ } ) ;
146169 return Promise . resolve ( null ) ;
170+ }
147171
148172 if ( ! latestRequest ) {
173+ // eslint-disable-next-line -- debugging
174+ console . log ( `getInMemoryEdgeConfig: creating new instance` ) ;
149175 latestRequest = fetchWithCachedResponse (
150176 `${ connection . baseUrl } /items?version=${ connection . version } ` ,
151177 {
@@ -183,6 +209,9 @@ function createGetInMemoryEdgeConfig(
183209 latestRequest = null ;
184210 } ,
185211 ) ;
212+ } else {
213+ // eslint-disable-next-line -- debugging
214+ console . log ( `getInMemoryEdgeConfig: using existing` ) ;
186215 }
187216
188217 if ( ! embeddedEdgeConfigPromise ) {
@@ -216,7 +245,11 @@ async function getLocalEdgeConfig(
216245 connection : Connection ,
217246 options ?: EdgeConfigFunctionsOptions ,
218247) : Promise < EmbeddedEdgeConfig | null > {
219- if ( options ?. consistentRead ) return null ;
248+ if ( options ?. consistentRead ) {
249+ // eslint-disable-next-line -- debugging
250+ console . log ( 'getLocalEdgeConfig: skipping for consistentRead' ) ;
251+ return null ;
252+ }
220253
221254 const edgeConfig =
222255 ( await getPrivateEdgeConfig ( connection ) ) ||
@@ -368,6 +401,8 @@ export const createClient = trace(
368401 if ( localOptions ?. consistentRead )
369402 addConsistentReadHeader ( localHeaders ) ;
370403
404+ // eslint-disable-next-line -- debugging
405+ console . log ( 'fetching edge config from network' ) ;
371406 return fetchWithCachedResponse (
372407 `${ baseUrl } /item/${ key } ?version=${ version } ` ,
373408 {
0 commit comments