Closed valtonia closed 5 months ago
thanks for raising this.
The biggest thing that stands out to me is that you say the URL it produces is
https://unleash.company.com/api?namePrefix=AH-
while the expected URL for fetching feature flags is https://unleash.company.com/api/client/features
.
In the PHP SDK doc it suggest to use the following format to use the namePrefix:
<?php
use Unleash\Client\UnleashBuilder;
use Unleash\Client\Helper\Url;
$builder = UnleashBuilder::create()
->withAppName('Some app name')
->withAppUrl(new Url('https://some-app-url.com', namePrefix: 'somePrefix.'))
->withInstanceId('Some instance id');
Have you tried this configuration?
Yes, I tried that.
Since raising the ticket I've been looking into the code and it seems the that the Url
class is just appending the prefix (and tags) to the URL but other parts of the code are not expecting that and are then appending /client/features
onto the end of it.
See line 120 of src/Repository/DefaultUnleashRepository.php
in the SDK. Here we see this line
->createRequest('GET', $this->configuration->getUrl() . 'client/features')
But the result from ->getUrl()
will already have the prefix and tags applied to it.
@valtonia Can you test that the fix in #206 applies to your problem?
@RikudouSage Can confirm that your fix works.
Describe the bug
Following the documentation when I try to pass in either a name prefix or tags in the URL using
UnleashBuilder::create()
I always get a 403 response.Steps to reproduce the bug
With this code
Which gives a URL like this
https://unleash.company.com/api?namePrefix=AH-
The response is always
Expected behavior
The flag should be retrieved without error.
Logs, error output, etc.
Screenshots
No response
Additional context
The same thing happens if I try to include any tags in the URL.
Unleash version
PHP SDK 2.4
Subscription type
None
Hosting type
Hosted by Unleash
SDK information (language and version)
PHP SDK 2.4