Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Expose a way to await the initial datafile download in initialize #10

Open
jrbarnard opened this issue Nov 4, 2020 · 0 comments
Open

Comments

@jrbarnard
Copy link

Currently if you run initialise then immediately run a route using the middleware you get errors due to the datafile not yet being downloaded.

It would be good to be able to await the initialiser otherwise you can't confirm that the middleware is ready
e.g:

import optimizelyExpress from '@optimizely/express';
const optimizely = optimizelyExpress(config);

await optimizely.onReady();

// Use the middleware

Errors:

[OPTIMIZELY] - ERROR 2020-11-04T14:25:26.653Z PROJECT_CONFIG_MANAGER: You must provide at least one of sdkKey or datafile. Cannot start Optimizely
Run middleware
[OPTIMIZELY] - ERROR 2020-11-04T14:25:26.662Z OPTIMIZELY: Optimizely object is not valid. Failing isFeatureEnabled.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant