dojoengine / dojo.js

Official JavaScript packages for Dojo.
https://dojoengine.github.io/dojo.js/
MIT License
28 stars 47 forks source link

[Bug]: Error accesing to Torii API from examples #240

Closed jorgezerpa closed 2 months ago

jorgezerpa commented 4 months ago

Dojo.js Version

0.7.3

What happened?

I followed along the steps of Contributing to Dojo Guidelines.

After finishing the installation steps, I tried to run the examples/react/react-app example following the examples guide.

It seems to goes all good, but when I opened http://localhost:5173/ it displays just a white screen instead of the app. This because the call to setup function from main.tsx is falling --> image

Debugging

I opened the console and found this message:

http://0.0.0.0:8080/world.World/WorldMetadata net::ERR_ADDRESS_INVALID

After, I go to the examples/react/react-app/src/dojo/generated/setup.ts file, and harcode the value for toriiUrl passed to torii.createClient function. I hardcoded the value to "http://localhost:8080" instead of the "http://0.0.0.0/8080" url that is been taking from the config.toriiUrl prop.

This seems to be the solution, because after this I was able to run the example without any problem.

Of course, hardcode the Torii url value is not the best practice. So I researched on the code and change the url on the next files:

But, despite that, when I ran the app again it still is using "0.0.0.0" instead of "localhost". Maybe I have to rebuild something again to make the changes take effect?

Looking on packages/core/src/constants/index.ts I found that LOCAL_KATANA variable is using localhost, so I think this is a suitable solution cause in the same file is the LOCAL_TORII variable (using 0.0.0.0) but again, I change it and not takes effect.

ps: I found this issue where the same function freeze the app, but it not seems to be related to this problem (https://github.com/dojoengine/dojo.js/issues/130)

What is the expected behavior?

Shows the example application

Steps to reproduce

Trace

image

Is there an existing issue for this?

jorgezerpa commented 4 months ago

If the solution is going the way I am, I would like to receive some feedback about my last question @ponderingdemocritus @tarrencev and be assigned to this same issue so I can fix it :)

DIWAKARKASHYAP commented 2 months ago

i want to work on this issue

ponderingdemocritus commented 2 months ago

This is fixed.