Open danilobassi8 opened 1 month ago
Hey, I'm not on the wesh/berty team but I've been playing around with this too. I actually have it somewhat working to the point where compiled go code can be used in an expo app. I'll push my changes up to a fork so you can see what I did (I hit a lot of the same things you did).
@danilobassi8, here you go: https://github.com/bluesliverx/weshnet-expo
GitHub🚧 [Work In Progress] 🚧 This library cannot be used yet!! - bluesliverx/weshnet-expo
I made these notes to myself as well in an app that is using it with this dependency in the package.json
file:
"@berty/weshnet-expo": "file:../weshnet-expo",
After making any changes to the code in weshnet-expo, run the following:
# In this repo
npm install
cd ../weshnet-expo
make all
After making changes to the native code in weshnet-expo, run the following:
#TODO Ensure that this is correct, the prebuild may not be needed?
# In this repo
npm install
cd ../weshnet-expo
make all
cd -
npx expo prebuild --clean
Finally, I should say after getting this working, I started playing around with the weshnet go code itself and found that the tutorial they provide does not work as is - the connect never happens. It must be something with my network setup or something, but I have yet to figure it out even when using go code directly.
@bluesliverx thanks for your comments. I tried your fork and I got this error when running npm run android
:
Android Bundling failed 85ms
error: ../src/index.ts: /home/danilo/dev/weshnet-expo/src/index.ts: Export namespace should be first transformed by `@babel/plugin-transform-export-namespace-from`.
11 |
12 | // Export these types to be used in consuming apps
> 13 | export * as ProtocolTypes from './api/protocoltypes.pb';
| ^^^^^^^^^^^^^^^^^^
14 | export * as Weshnet from './weshnet.types.gen';
15 |
16 | export async function init(): Promise<ProtocolServiceClient> {
If I checkout to your previous commit, I have the same error as the original repo.
This is why I haven't pushed anything up 😅
Try removing those star imports for the types, it's likely not the right way to do it anyways
I got stuck at the same point when trying to run it for Android. The execution deads in await WeshnetExpoModule.init()
(in src/index.ts
).
I'd like to add to this issue that when running adb logcat
in a terminal I'm seeing:
08-09 00:08:46.733 12174 12266 I ReactNativeJS: Starting initialization...
08-09 00:08:46.733 12174 12266 I ReactNativeJS: Initializing WeshnetExpoModule...
08-09 00:08:46.741 12174 12290 E GoLog : 2024-08-09T00:08:46.741Z ERROR core core/builder.go:158 constructing the node: could not build arguments for function "github.com/ipfs/kubo/core/node".PeerWith.func1 (/home/baffo/.asdf/installs/golang/1.19.7/packages/pkg/mod/github.com/ipfs/kubo@v0.19.0/core/node/peering.go:29): failed to build *peering.PeeringService: could not build arguments for function "github.com/ipfs/kubo/core/node".Peering (/home/baffo/.asdf/installs/golang/1.19.7/packages/pkg/mod/github.com/ipfs/kubo@v0.19.0/core/node/peering.go:14): failed to build host.Host: could not build arguments for function "github.com/ipfs/kubo/core/node/libp2p".Host (/home/baffo/.asdf/installs/golang/1.19.7/packages/pkg/mod/github.com/ipfs/kubo@v0.19.0/core/node/libp2p/host.go:40): could not build value group []config.Option[group="libp2p"]: received non-nil error from function "github.com/ipfs/kubo/core/node/libp2p".ResourceManager.func1 (/home/baffo/.asdf/installs/golang/1.19.7/packages/pkg/mod/github.com/ipfs/kubo@v0.19.0/core/node/libp2p/rcmgr.go:31): o
08-09 00:08:46.741 12174 12290 E GoLog : pening IPFS_PATH: exec: "getent": executable file not found in $PATH
08-09 00:08:46.745 12174 12266 E ReactNativeJS: 'Initialization error:', { [Error: CoreError] code: 'ERR_WESHNET_CORE_ERROR' }
08-09 00:08:46.761 12174 12266 E ReactNativeJS: 'WeshnetExpo.init() error:', { [Error: CoreError] code: 'ERR_WESHNET_CORE_ERROR' }
Note: the ..I ReactNativeJS..
are just some messages I added for debugging.
It seems that something is wrong in either IPFS_PATH
or getent
. Idk if it makes sense that you are trying to run getent
on Android.
@jefft0 to try to reproduce the error on an Ubuntu VM.
Thank you for opening the issue 🙏 We confirm this is an important bug and we need to fix it.
To put things in perspective, we are currently focused on fixing the RDV server issues (which requires updating a lot of components, a laborious task). So, we could approximate Sept 2024 when we will attack this Expo Module bug.
We imagine it is frustrating to have so slow times of addressing important bugs, but we have limited resources and a few very important priorities in some tangent projects. However, we will improve Berty Messenger and more than that, have the Wesh Network protocol power more decentralized dApps. Stay tuned :)
This is the same problem I'm hitting locally with pure go code I believe as well. Thanks everyone for looking into it
Hello @danilobassi8 . I am trying to reproduce your bug. I think you got farther than I did in the build process. I'm getting an error from gradle. So, what is your version of the Android SDK? If you installed Android Studio, what is its version? Thanks.
Hi @jefft0 , thanks for addressing this issue. I'm using the latest Android Studio downloaded from the official page.
I'm using it with default settings, but I also tried other JDKs to check if it works, but it didn't.
Hello @danilobassi8 . I have reproduced your error Cannot read property 'serviceGetConfiguration' of undefined
. Now that I can reproduce the error, I will get our expo devs to look at it, and the comments from @bluesliverx .
Hi guys, thanks for the efforts you put into making this expo module.
I've been trying to make a React app that uses the wesh protocol for the last weeks. I know nothing about golang, but I read on the discord channel that you've been working on this package to abstract the complexity of having to compile go code, and build our own native layer.
When I try to run the provided example app on the
/example
directory, I am having some errors. I'll put all the steps I made in order to make it "almost" work in my setup.Setup
OS: Ubuntu 22.04 LTS Phone: Motorola g100 with Android 12.
Steps to reproduce the error:
1 - Clone the repo and install packages.
2 - Run the provided example
After this step, I'm seeing this error:
After adding
buf 1.15.1
in the .tool-versions, and runningmake asdf.install_plugins
andmake asdf.install_tools
again, and re-runningnpm run android
now I see this issue:In my case, the solution to this error was creating a /tmp directory and adding this in line 103 on the Makefile at the root of the project.
with this little changes, now I'm able to build the code. But as soon as I open the app on my phone, I see some errors, and the expo console says this:
Trying to debug what is going on, I replaced this line in
WeshnetExpoModule.kt
Now, in the console, I'm able to see this error:
I don't know how to fix that issue. And I don't know if this is something on your side or a third party library you use.
I remember reading on the discord channel that your priorities have changed since the weshnet-expo project was created, and the last commit was 10 month ago, but I'd be glad to help in this project because I truly believe that this is the best way to expose the wesh protocol for react devs.
Let me know if you need help on testing this issue. Thanks in advance!