Hi, i'm using custom UI - react. i have supertokens core installed in local. used 'supertokens start...
g
Hi, i'm using custom UI - react. i have supertokens core installed in local. used 'supertokens start' to run it. when i ping curl http://localhost:3567/hello i'm getting reply hello, but in the app when i try to http://localhost:3001/auth/signup, it shows 500 status code on sign up endpoint and also tried in postman it's throwing error as TypeError: fetch failed at Object.fetch (node:internal/deps/undici/undici:11372:11) at processTicksAndRejections (node:internal/process/task_queues:95:5) at sendRequestHelper._a (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\querier.js:51:36) at Querier.sendRequestHelper (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\querier.js:326:32) at Querier.getAPIVersion (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\querier.js:41:38) at sendRequestHelper._a (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\querier.js:177:38) at Querier.sendRequestHelper (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\querier.js:326:32) at Querier.sendGetRequest (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\querier.js:173:40) at Object.listUsersByAccountInfo (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\recipe\accountlinking\recipeImplementation.js:161:26) at Recipe.isSignInUpAllowedHelper (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\recipe\accountlinking\recipe.js:280:25) supertokens core is running as you can see in the image. if anyone facing same issue and got it resolved kindly share the solution.
r
hey @gsj this is usually cause the backend process you have isn't able to connect to the core cause of firewall settings
g
so what should i do to resolve this? can you share some steps?
r
Depends on your operating system. Not sure, since this is outside the scope of a supertokens issue.
You can instead try using docker
Or our managed service for the core
g
i tried docker. it's only running in-memory not connecting to MySQL DB which is in local even if i use MySQL connection details like this docker run -p 3567:3567 --network=host -e MYSQL_CONNECTION_URI="mysql://root:root@localhost:3306/supertokens" -d registry.supertokens.io/supertokens/supertokens-mysql
r
you should use docker compose
g
i want to self hosted core
r
And you can’t use localhost cause that points to in the docker container
g
i want to use self hosted supertokens core or docker to connect to my MySQL DB so that all data can be stored in my own DB. how to do that? I'm testing in local for now probably move to could if everything works fine.
i tried it with prebuilt UI everything working fine and successfully stored user data in local MySQL DB, now I'm building custom UI with same process followed as in Docs but it's not working.
@rp_st i have used docker run -p 3567:3567 --network=host -e MYSQL_CONNECTION_URI="mysql://root:root@localhost:3306/supertokens" -d registry.supertokens.io/supertokens/supertokens-mysql this to connect to MySQL which is in my local machine while using prebuilt UI. but now that also not working. it will only use in-memory to store data.
i have tried docker compose as you suggested will attach screenshot of that as well but still supertokens core is using in-memory to store user data. how to resolve it please suggest some solutions.
r
can i see the docker logs from the supertokens container?
g
here is the log for MySQL DB
here is the log for supertokens core
Hy @rp_st there is any detailed guide or example app with react+typescript which is built with custom UI and selfhosted core and MySQL DB?
r
it does say that it has connected to the mysql db
g
There is nothing in DB and also in postman it says email already exists
r
r u checking the right db? Im not sure about your setup
so not sure how to help here.
but the core has connected to the msyql db
g
i have only one supertokens DB in local setup. i have also checked in MySQL workbench. it shows no data but earlier when i first tried with Prebuilt UI Setup it was storing data to MySQL DB in my local machine. that why i proceeded with custom UI setup.
r
using pre built ot custom UI has nothing to do with db connection
anyway, im not sure how to help here more, since the logs clearly show it has connected to mysql
g
Yes if it is the case then it should store the user data to the DB right? but when the i stop the supertokens core or the docker container data is wiped out.
r
can you delete all the tables from the mysql and restart the core? Does it recreate all the tables?
g
Yesturday i did that. deleted everything and started the core but it didn't do any changes to the DB, no tables were created but i was able to create user, login the user and also accessed the user management dashboard.
r
can you try again and show the logs of the core when it starts?
if you can't figure it out, please create an issue about it with detailed steps on how to reproduce it please.
we will check it out when we have time.
g
okay, i will delete all the tables and start the supertokens core again. steps i'll be doing: delete the tables in supertokens database use docker compose up -d to run the core that's it right?
r
yea, and make sure that the db has persistrant storage
try once without docker
g
sure. one more thing i wanted ask, is it possible to create a react + typescipt guide or example app with custom UI setup with all the features implemented so that i will be helpful.
r
we might do it when we have time 🙂
g
without docker i need to install core locally and run it right?
r
i mean try without docker compose
g
sure thanks
@rp_st as you have suggested i have deleted all the tables and used
supertokens start
to run the core with MySQL. it created tables but when i tried to create user it is throwing issue like this.
if i use docker
docker run -p 3567:3567 -v /path/to/config.yaml:/supertokens/config.yaml -d registry.supertokens.io/supertokens/supertokens-mysql
it's using in-memory storage.
i have used
docker run -p 3567:3567-e MYSQL_USER="root" -e MYSQL_HOST="localhost" -e MYSQL_PORT="3306" -e MYSQL_PASSWORD="root" -d registry.supertokens.io/supertokens/supertokens-mysql
here it's not connecting to MySQL
her is the config.yaml file which contains connection URI to MySQL
r
so if it created the tables, it means that it connected to the db successfully
g
but when i tried to create user it's throwing error. why is that?
r
the backend is not able to connect to the core
g
if you say so when i use docker compose there is no issue. everything is running fine. this error is thrown only when is use local supertoken core with MySQL.
Yes. but now it's working. i have changed connectionURI from "http://locahost:3567" to "http://127.0.0.1:3567" in the backend config. now the users data is getting stored in MySQL DB.
@rp_st Thanks for the help!
7 Views