File tree Expand file tree Collapse file tree
openfeature-node-provider/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -794,7 +794,7 @@ export class BucketClient {
794794 `get request to "${ path } " failed with error after ${ retries } retries` ,
795795 error ,
796796 ) ;
797- throw error ;
797+ return undefined ;
798798 }
799799 }
800800
@@ -1314,13 +1314,19 @@ export class BucketClient {
13141314 params . append ( "key" , key ) ;
13151315 }
13161316
1317- try {
1318- const res = await this . get < EvaluatedFeaturesAPIResponse > (
1319- `features/evaluated?${ params } ` ,
1320- ) ;
1317+ const res = await this . get < EvaluatedFeaturesAPIResponse > (
1318+ `features/evaluated?${ params } ` ,
1319+ ) ;
13211320
1321+ if ( res ) {
13221322 if ( key ) {
1323- if ( ! res . features [ key ] ) throw new Error ( `Feature ${ key } not found` ) ;
1323+ if ( ! res . features [ key ] ) {
1324+ this . logger . error ( `feature ${ key } not found` ) ;
1325+ return this . _wrapRawFeature ( contextWithTracking , {
1326+ key,
1327+ isEnabled : false ,
1328+ } ) ;
1329+ }
13241330 return this . _wrapRawFeature ( contextWithTracking , res . features [ key ] ) ;
13251331 } else {
13261332 return Object . fromEntries (
@@ -1330,16 +1336,14 @@ export class BucketClient {
13301336 ] ) ,
13311337 ) ;
13321338 }
1333- } catch ( err ) {
1334- this . logger . error ( `failed to fetch evaluated features: ${ err } ` , err ) ;
1335- if ( key ) {
1336- return this . _wrapRawFeature ( contextWithTracking , {
1337- key,
1338- isEnabled : false ,
1339- } ) ;
1340- } else {
1341- return { } ;
1342- }
1339+ }
1340+ if ( key ) {
1341+ return this . _wrapRawFeature ( contextWithTracking , {
1342+ key,
1343+ isEnabled : false ,
1344+ } ) ;
1345+ } else {
1346+ return { } ;
13431347 }
13441348 }
13451349}
Original file line number Diff line number Diff line change @@ -100,8 +100,8 @@ export class BucketNodeProvider implements Provider {
100100 } ) ;
101101 }
102102
103- const features = this . _client . getFeatureDefinitions ( ) ;
104- if ( flagKey in features ) {
103+ const featureDefs = this . _client . getFeatureDefinitions ( ) ;
104+ if ( featureDefs . some ( ( { key } ) => key === flagKey ) ) {
105105 return resolveFn ( this . _client . getFeature ( context , flagKey ) ) ;
106106 }
107107
You can’t perform that action at this time.
0 commit comments