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

Refactor the SDK imports to prevent require cycles #29

Open
nkshah2 opened this issue Oct 19, 2021 · 3 comments
Open

Refactor the SDK imports to prevent require cycles #29

nkshah2 opened this issue Oct 19, 2021 · 3 comments

Comments

@nkshah2
Copy link
Contributor

nkshah2 commented Oct 19, 2021

When using the SDK on iOS (tested with the example app in the repo) the bundler complains about require cycles in the code. One example of this is fetch.ts which imports recipeImplementation.ts which also imports fetch.ts. While this is allowed and should not cause issues, react native warns that it might lead to uninitialised variables in future releases. We should refactor this to prevent cycles

@lyqht
Copy link

lyqht commented Jan 20, 2022

Tried the example app in this project on on both iOS and android, this is still an issue.

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
 WARN  Require cycle: node_modules/supertokens-react-native/lib/build/fetch.js -> node_modules/supertokens-react-native/lib/build/recipeImplementation.js -> node_modules/supertokens-react-native/lib/build/fetch.js

In fact, after I connect my google account, nothing seems to happen afterwards. I'm still at the screen where the 3 buttons to login are found.

@nkshah2
Copy link
Contributor Author

nkshah2 commented Jan 27, 2022

Hi @lyqht,

While the warning about require cycles will still appear, it does not cause any issues for now. I ran the demo app again to verify, and the flow works fine there.

If you followed the steps in the README for the demo app, can you share any logs that appear in the Metro bundler or the Node server?

@lyqht
Copy link

lyqht commented Feb 3, 2022

hi @nkshah2, thank you for clarifying! I tested again, and it works now. It wasn't because of the require cycles problem - I just thought that the IP address given in the App.js is already correct and didn't update it to my own IP address previously. Now that I updated it, I can login to both GitHub & Google successfully through the example app.

image

The command I used to get the IP address is from this StackOverflow thread, maybe we can consider adding an example to the README.

ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'

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

3 participants