Skip to content

Help debugging crash on load when requiring Hyperswarm #352

@saimonmoore

Description

@saimonmoore
  • Project: nodejs-mobile-react-native
  • Version: 16.17.10
  • Mobile device: both iphone 13 device and iphone 14 simulator give similar results
  • Mobile OS and version: iOS 16.1.2
  • Development Node.js: v16.19.0
  • Development platform: Darwin nb-smoore3.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 arm64

Installed v16.17.10 of nodejs-mobile-react-native package into a new react native app (v0.71.6) and managed to get messages to and from node and js. That went fine.

But my objective is to integrate a nodejs backend that uses hypercore/hyperbee and hyperswarm.

I figured that there might be issues with native package dependencies for these packages so I decided to just require 'hyperswarm` in main.js.

It failed with some build errors about sodium-native so I decided to try https://github.com/staltz/sodium-native-nodejs-mobile.

I tried the following approaches:

  • Manually modify the package.json files of the following dependencies:
    "sodium-universal", "sodium-secretstream" and "hmac-blake2b" to remap 'sodium-native' to 'sodium-native-nodejs-mobile'.
  • Manually modify the package.json files of the following dependencies:
    "sodium-universal", "sodium-secretstream" and "hmac-blake2b" to remap 'sodium-native' to 'sodium-javascript'.
  • Use the same approach used by the Telios Mobile app whereby they recreate the package.json's to use 'sodium-native-nodejs-mobile'

In all of the above cases I manage to get the app to build but it crashes on loading with:

https://gist.github.com/saimonmoore/867af24d6e5c883c26fa1e876957389a

I can see that there is some kind of exception when starting the node server process but there's no other clue.
I'm not able to get any other logs that could point to the issue. (Not an ios dev and when I tried building in xcode, one of the phase scripts fails but again no logs and no pointers. I have to say that these scripts do not appear to be failing during building via yarn react-native run-ios)

My code is here: https://github.com/saimonmoore/mneme/tree/rn-nodejs/apps/mobile

Here are the build logs: https://gist.github.com/saimonmoore/ae353f660ed936c0cd794be5d2887278

As I said, I feel like I've hit a brick wall here. Not sure how to get past this point or where to look to get further clues :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions