Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Random error with initialization client #263

Open
1 task done
kimyu92 opened this issue May 16, 2024 · 1 comment
Open
1 task done

[BUG] Random error with initialization client #263

kimyu92 opened this issue May 16, 2024 · 1 comment
Labels
acknowledged bug Something isn't working needs-triage question Further information is requested waiting-requestor

Comments

@kimyu92
Copy link

kimyu92 commented May 16, 2024

Is there an existing issue for this?

  • I have searched the existing issues

SDK Version

react-sdk v3.1.0

Current Behavior

We currently have logs indicating random requests getting the following error

message:Request error stack:Error: Request error at responsePromise.n.onreadystatechange

image

Expected Behavior

No error

Steps To Reproduce

// or this is written inside useEffect
const client = createInstance({
    sdkKey: 'SDK_KEY',
    datafileOptions: {
      autoUpdate: true,
      updateInterval: 300000,
    },
    eventBatchSize: 10,
    eventFlushInterval: 1000,
    errorHandler: {
      handleError: (e: Error) => {
        console.log(e.message, e.stack);
      },
    },
    odpOptions: {
      disabled: true,
    },
});

const OptimizelyFlagProvider = () => {
  // some useState
  
  useEffect(() => {
    const isClientValid = () => {
      return client?.getOptimizelyConfig() !== null;
    };

    client?.onReady().then((ocInstance: OnReadyResult) => {
      if (isClientValid()) {
          // set valid state
      }
      else {
          // set error state
      }  
    }(
  }, []);
  
  return (
    <OptimizelyProvider optimizely={client} timeout={500} user={{ id: 'userId' }}>
       // error and successful body {....}
    </OptimizelyProvider>
   );
}

React Framework

18.2.0

Browsers impacted

Chrome latest version

Link

No response

Logs

No response

Severity

Affecting users

Workaround/Solution

No response

Recent Change

No response

Conflicts

No response

@kimyu92 kimyu92 added bug Something isn't working needs-triage labels May 16, 2024
@junaed-optimizely
Copy link
Contributor

Hey @kimyu92! Your provided error log indicates that the client is facing network issue while synching the datafile. However, I could not reproduce the issue with your given snippet. So, if you could provide more context that would be nice.

@junaed-optimizely junaed-optimizely added question Further information is requested waiting-requestor labels Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged bug Something isn't working needs-triage question Further information is requested waiting-requestor
Projects
None yet
Development

No branches or pull requests

2 participants