Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for additional endpoints #68

Closed
egiberti opened this issue Aug 1, 2019 · 4 comments
Closed

Add support for additional endpoints #68

egiberti opened this issue Aug 1, 2019 · 4 comments

Comments

@egiberti
Copy link

egiberti commented Aug 1, 2019

Currently some endpoints return an HTTP 404 from the ld-relay host. This is problematic if running ld-relay in relay proxy mode. Switching to daemon mode can alleviate this in some cases, but adds a dependency on Redis to application code. The alternative is adding logic to the application to make some requests through the relay and others directly to the LaunchDarkly service.

Example request:

$config = [
    'feature_requester' => new LaunchDarkly\Impl\Integrations\GuzzleFeatureRequester(
        'http://ld-relay.example.com:8030', 
        $apiKey, 
       [] // config'd as needed
    )
];
$ldClient = new \LaunchDarkly\LDClient($apiKey, $config)

$ldUser = new \LaunchDarkly\LDUserBuilder($userId); // config'd as needed
$ldClient->allFlagsState($ldUser);

This adds a couple of entries to the logs and comes back with no flags.

[2019-08-01 09:05:48] LaunchDarkly.ERROR: Received error 404 for GuzzleFeatureRequester::getAll - giving up permanently [] []
[2019-08-01 09:05:48] LaunchDarkly.ERROR: Due to an unrecoverable HTTP error, no further HTTP requests will be made during lifetime of LDClient [] []

Looking in the PHP SDK code to see what URL is being requested shows /sdk/flags. Making that request via curl directly to the ld-relay host confirms what the logging stated before, a missing endpoint.

curl -X GET -H "Authorization: sdk-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" http://ld-relay.example.net:8030/sdk/flags
404 page not found

The same request on the LaunchDarkly app host app.launchdarkly.com returns a JSON blob of current flag data; as expected. Ideally, the request would be answered with the state already stored in ld-relay and transparently proxied through to LaunchDarkly in the event the flag state isn't currently in memory.

@eli-darkly
Copy link
Contributor

Thanks for catching this. PHP uses different endpoints than all of the other SDKs, because of HTTP caching considerations, and we failed to notice that we hadn't implemented those endpoints in ld-relay because all of our current PHP-using customers (as far as we knew) were using Redis. This will be added in the next ld-relay release after 5.6.0.

@egiberti
Copy link
Author

I just tried a build with version 5.6.1 and it still behaves the same way, returning a 404 when accessing /sdk/flags. Do you have any idea when a version that will support this will be released?

@eli-darkly
Copy link
Contributor

Sorry, I should have said "the next ld-relay minor version release" since this would be new behavior (even though it should have been implemented before). The 5.6.1 release was an unrelated bugfix patch, as described in the release notes. I don't know of the exact time frame for implementing this, but will update this issue to keep you posted.

This was referenced Sep 18, 2019
@eli-darkly
Copy link
Contributor

This is implemented in the 5.7.0 release.

LaunchDarklyCI pushed a commit that referenced this issue Nov 7, 2019
These urls are passed directly to the go client which expects them not to have a trailing slash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants