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

Not working after upgrade to React Native 0.60.x #230

Closed
3 tasks done
bneigher opened this issue Jul 19, 2019 · 5 comments
Closed
3 tasks done

Not working after upgrade to React Native 0.60.x #230

bneigher opened this issue Jul 19, 2019 · 5 comments

Comments

@bneigher
Copy link

bneigher commented Jul 19, 2019

Description

I seem to be running into a runtime issue with the functionality of react-native-auth0 after upgrading from RN 0.59.9 to RN 0.60.3.
This seems to only have an effect on the simulator.

Seems that there is an issue with handling the responses made after HTTP requests are made by this sdk. To be clear - I can see the requests being sent with the correct parameters, but the response preview doesn't show any data in chrome debugger, the promise resolves successfully, but there is an error:
AuthError: unknown error

After adding some debugging to the src, it looks like the http requests don't contain a json property?

image

Prerequisites

  • Did you check the documentation? [Add a link]
  • Did you check the Auth0 Community?
  • Are you reporting this to the correct repository?
  • [-] Are there any related or duplicate Issues or PRs for this issue?

Environment

Please provide the following:

  • React Native Auth0 version

1.5.0

  • React Native version

0.60.3

  • iOS Setup

Simulator, iPhoneX

  • Android Setup

Not tested yet (androidx support?)

Reproduction

export const loginWithUserPass = async (username, password) => {
  console.log("loginWithUserPass");
  try {
    const res = await auth0instance.auth.passwordRealm({
      scope: "openid offline_access profile email",
      audience: Config.AUTH0_AUDIENCE,
      device: DeviceInfo.getUniqueID(),
      realm: Config.AUTH0_REALM,
      username,
      password
    });
    console.log("res", res);
    return res;
  } catch (err) {
    console.log(err);
  }
};

Again - this only affects the simulator apparently.
Anyone else seeing this?

@bneigher
Copy link
Author

bneigher commented Jul 22, 2019

Seems that this code is throwing, and then the error is being muted due to the catch statement trying to gracefully resolve (...should this be a graceful failure?) The request is failing here:
https://github.com/auth0/react-native-auth0/blob/master/networking/index.js#L79-L88

With the error at response.json() throwing:
SyntaxError: Unexpected token o in JSON at position 1

Has fetch changed lately or something?

@bneigher
Copy link
Author

AH! Looks like there is a new issue in react-native:
facebook/react-native#25701
Looks like this solution works, perhaps it should be added to the auth0 source?
Adding global.Blob = null anywhere in your code fixes the problem

@lbalmaceda
Copy link
Contributor

@bneigher it seems like a bug on the latests react-native version. What if you move to a previous patch? e.g. 0.6.0, 0.6.1 or 0.6.2. Is the issue still happening?

@bneigher
Copy link
Author

Yep thats what I found. Downgrading works, but I'm cool with the fix referenced in my comment above

@lbalmaceda
Copy link
Contributor

👍I don't think we should be changing that from the SDK side. I don't even know if adding that today would break older React Native versions.. And since this SDK doesn't specify a react-native version, I think it's best to delegate that decision to the users. Probably the next RN patch fixes it.
Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants