Skip to content

Lock Slow Load: An error occurred when fetching data. #957

Description

@brassier

Lock version: 10.13.0
Browser & OS: Chrome 56.0.2924.87 & Windows 10

When developing an application I occasionally have slow load times due to re-builds happening. This frequently causes Auth0 to kill page execution with the error:
An error occurred when fetching data

I believe this happens due to /utils/cdn_utils.js creating a <script> tag for Lock and appending it to the page, and then setting a 5 second timeout to error if it's not loaded. When this error happens it lands in /sync.js at handleError(). The key in this case is "client", so it bombs.

There is a TODO comment on this method to have a configurable error for each key. Can something less aggressive be done with a key of "client"? Or can the wait time be increased to be more than 5 seconds? The code that bombs in sync.js is below.

function handleError(m, key, error) {
  let result = setStatus(m, key, "error");

  // TODO: this should be configurable for each sync
  if (key !== "sso") {
    const stopError = new Error(`An error occurred when fetching data. (key: ${key})`);
    stopError.code = "sync";
    stopError.origin = error;
    result = l.stop(result, stopError);
  }

  return result;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions