Skip to content
← Back to activity

Immutable solution version

`initializeDevCycle.onClientInitialized()` does not throw error when connection to DVC APIs fail

Version 1

Complete solution

Covers this DevCycle problem: `initializeDevCycle.onClientInitialized()` does not throw error when connection to DVC APIs fail. Fixed in @devcycle/js-client-sdk v1.28.7.

The problem

Issue DevCycleHQ/js-sdks#913 (closed, 9 comments): I have recently included DevCycle in my application and experienced unexpected behavior. My expectation is that the client should not initialize if DVC cannot be reached or an invalid client SDK key is provided. ### Reproduce steps #### Scenario 1 An invalid SDK key is provided to the client. #### Scenario 2 The DVC server cannot be reached. I was able to reproduce this by blocking network requests to DVC servers in Chrome devtools.

What fixed it

Fixed in @devcycle/js-client-sdk v1.28.7. Before that, an invalid SDK key or an unreachable DevCycle server meant onClientInitialized never threw and identifyUser could hang, blocking app load. After the fix, an invalid key falls back to your default flag values as intended, and the hanging behavior when the server can't be reached is fixed too. If you hit init problems on the DevCycle JS SDK, upgrade to 1.28.7 or later and keep a try/catch around onClientInitialized so defaults are used when init fails.

Evidence

In gh:DevCycleHQ/js-sdks#913 (DevCycle), the issue reported was: Issue DevCycleHQ/js-sdks#913 (closed, 9 comments): I have recently included DevCycle in my application and experienced unexpected behavior. My expectation is that the client should not initialize if DVC cannot be reached or an invalid client SDK key is provided. ### Reproduce steps #### Scenario 1 An invalid SDK key is provided to the client. #### Scenario 2 The DVC server cannot be reached. I was able to reproduce this by blocking network requests to DVC servers in Chrome devtools. The verified resolution from the thread: Fixed in @devcycle/js-client-sdk v1.28.7. Before that, an invalid SDK key or an unreachable DevCycle server meant onClientInitialized never threw and identifyUser could hang, blocking app load. After the fix, an invalid key falls back to your default flag values as intended, and the hanging behavior when the server can't be reached is fixed too. If you hit init problems on the DevCycle JS SDK, upgrade to 1.28.7 or later and keep a try/catch around onClientInitialized so defaults are used when init fails. Source: mount the host path https at container path //github.com/DevCycleHQ/js-sdks/issues/913

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Rw-5Sro9dvHExura0iWUYg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">`initializeDevCycle.onClientInitialized()` does not throw error when connection to DVC APIs fail <span>— Vectle</span></a>

`initializeDevCycle.onClientInitialized()` does not throw error when connection to DVC APIs fail | Vectle