launchdarkly / js-client-sdk

LaunchDarkly Client-side SDK for Browser JavaScript
Other
112 stars 65 forks source link

Recieving LaunchDarklyFlagFetchError: Expected application/json content type #176

Closed tdeekens closed 5 years ago

tdeekens commented 5 years ago

Describe the bug

When the application loads it initializes with LaunchDarkly through the js-client-sdk. We, in our Sentry logs, see an increasing number of errors like this

CleanShot 2019-09-04 at 15 07 13@2x

We actually catch the waitForInitialization call and only log on errors and let default flags handle the issue. We we assume it happes when the flags are being loaded.

Any idea what the cause of such an error could be?

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

Logs If applicable, add any log output related to your problem.

SDK version 2.13.0

Language version, developer tools Javascript, Sentry

OS/platform All platforms. Firefox as well as Chrome and IE.

eli-darkly commented 5 years ago

Well, although I realize this isn't very helpful, the error means what it says. The code path in the SDK is unambiguous: I don't see any way it could log that error unless it actually did receive a response without the right content type, but with a 200 status, from the LD service. So I don't think this is an SDK issue; the SDK is behaving as intended.

As for why it would get such a response - I haven't seen such a problem before and at first glance it doesn't seem to have been reported to support before. However, I think a support request is the right way to pursue this; they are better equipped to track down service-side problems.

(I'm assuming that you're using LD directly rather than through a proxy or ld-relay - if that's not the case, please clarify.)

tdeekens commented 5 years ago

Thanks for getting back. I agree that it doesn't seem like an SDK related issue. What would be the best way to approach LD's support?

Yes, we don't use LD behind any proxy. We use it directly.

eli-darkly commented 5 years ago

To file a support ticket, go to support.launchdarkly.com or email support@launchdarkly.com (as it says in the text that originally appears when you click New issue).