launchdarkly / ld-relay

LaunchDarkly Relay Proxy
Other
111 stars 80 forks source link

Container should exit with non-zero code on AutoConfigKey error #165

Closed barakbd closed 2 years ago

barakbd commented 2 years ago

Is this a support request? This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here or by emailing support@launchdarkly.com.

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

Describe the bug When an incorrect auto config key is set, the container logs an error but continues to run. This is confusing, as the container should stop running and exit with a non-zero exit code to indicate an immediate problem - fail fast.

To reproduce Deploy LDRP with incorrect auto config key

Expected behavior Container exits with non-zero code.

Logs

2022/01/28 10:02:37.446552 INFO: Starting LaunchDarkly relay version 6.6.2 with configuration from environment variables
2022/01/28 10:02:37.451774 INFO: Successfully registered Datadog metrics exporter
2022/01/28 10:02:37.453347 INFO: [AutoConfiguration[] Connecting to auto-configuration stream at https://stream.launchdarkly.com/relay_auto_config
2022/01/28 10:02:37.455837 INFO: Starting server listening on port 8030
2022/01/28 10:02:37.850626 ERROR: [AutoConfiguration[] Invalid auto-configuration key; cannot get environments
2022/01/28 10:02:37.850670 ERROR: [AutoConfiguration[] Unexpected error on auto-configuration stream: error 401

SDK version N/A

Language version, developer tools N/A

OS/platform Ubuntu

Additional context Add any other context about the problem here.

eli-darkly commented 2 years ago

Thanks for catching this. Should be easy to fix.

When there's an error on an individual environment (like, the SDK key is wrong), we deliberately don't exit unless the ExitOnError option was set, since other apps might be relying on other environments which are working. But if the auto-config key is wrong, there won't be any environments at all and Relay won't accept any requests, so there's no reason for it to keep running.

eli-darkly commented 2 years ago

(Filed internally as 140317)

eli-darkly commented 2 years ago

Version 6.6.4 has been released with this fix.

barakbd commented 2 years ago

Thanks!