launchdarkly / ios-client-sdk

LaunchDarkly Client-side SDK for iOS (Swift and Obj-C)
https://docs.launchdarkly.com/sdk/client-side/ios
Other
68 stars 82 forks source link

Setting a nil context breaks LaunchDarkly #395

Open kylebrowning opened 3 weeks ago

kylebrowning commented 3 weeks ago

Describe the bug Title really says it all, if you omit context in the start function

        LDClient.start(
            config: config,
            context: nil,
            startWaitSeconds: 5
        )

Launch Darkly will refuse to launch.

Expected behavior A clear and concise description of what you expected to happen.

Logs

Waiting 25.457 seconds before reconnecting...
Starting EventSource client
Initial reply received
Unsuccessful response: 400
State: closed -> closed
Waiting 16.171 seconds before reconnecting...

Library version The version that you are using.

XCode and Swift version Xcode 15.4 Swift 5.0 Platform the issue occurs on iPhone

Additional context Can you provide details on what happens in the case of failure for

        guard case .success(let context) = contextBuilder.build() else { return }

Having to always provide a context is a bit cumbersome, and if LaunchDarkly client fails to startup it could have pretty bad consequences downstream.

keelerm84 commented 3 weeks ago

@kylebrowning I'm sorry you're experiencing an issue. Can you tell me which version of the SDK you are using?

I did test the latest version and it seems to work just fine without an explicit context, so maybe this is an issue with an older version.

kylebrowning commented 3 weeks ago

im on the latest, this is my first time using LD, and I just included it in the project