It does not get past connectAuthorised and returns the infamous “Could not connect to the SAFE Network” error.
I have also encountered the exact same using the API playground by @hunterlester. (Using the same order: initialise, authorise and connectedAuthorised.) However, it only happens in the mock browser. It does not happen on the live Alpha 2 network.
Could anyone confirm this or spot a mistake in my process?
This error can be thrown if the network configs are missing. But if you’ve downloaded the latest browser package, then it should be included (grabbing now to double check for me).
In the meantime, can you log the appHandle / uri just to check they are legit.
@bzee if you are using the mock version of SAFE Beaker browser 0.10.2 you’ll need to set the env var NODE_ENV=dev in order to work properly, did you set this when trying with mock?
Anyway, I just tried running the ‘SAFE Browser’ executable from an environment with the variable set. It makes no difference. So I assume it’s not needed.
Can you please try by first removing you MockVault file and launching the mock browser again with the env set? (please make a backup of the mockvault we might be able to use it to reproduce the issue actually)
Thanks, that seems to work! I do not remember having to set the environment variable for a mock build specifically (especially since it’s a hassle in comparison to just launching the executable). Has this changed?
It hasn’t change, it’s been always like that for Beaker browser, and we were actually trying to remove it, and that’s what we did in Peruse already as it’s really not nice.
Thanks for looking into this! Sorry for not seeing it was reported already on the JIRA; I’ve tried searching for the issue there briefly but could not find any.
I’m confused. It if has always supposed to be like this, then there is no issue, right? Then this is just expected behavior.
I just looked at the README and it does not mention setting the variable before launching the executable. I also downloaded version 0.9, and it works without setting the environment variable. I’m quite sure I’ve never had to set NODE_ENV before launching the executable…
Yes it was always like this for our Beaker browser, so it’s expected that you need to set the env var when running it for mock. What it’s not expected is the error you had even when setting the env var which is reported in Jira.
In the README we have replaced the part where we explained setting the env var with the instruction to use another script which does it for you: "If you're actively developing, you can run 'yarn mock' instead of 'yarn' in order to get the 'safe_client' libraries which use the 'MockVault' file rather than connecting to the SAFE Network."
I can only speculate with you having it set globally in your env? but I don’t know obviously, but if you look at the dev hub we even made sure to include that in the instructions: https://hub.safedev.org/platform/web/#install-a-safe-browser
Interesting! But, I’m not talking about the build process. I’m using pre-built releases from GitHub…
I just tested three versions: 0.8, 0.9 and 0.10. I first removed the mock vault file, then launched the version (mock) and used the playground to connect. Only 0.10 gives me the error ‘Could not connect …’, the other two do not.
This might be connected with the issue in 0.10?
Thanks for pointing me to that! Could it be added to the 5th step of the README too?
It tells how to package, but it doesn’t say the NODE_ENV should be set to dev when launching the mock build. (Which is why I thought the environment variable was never needed to be set before launching the mock version.)
I appreciate the answers. I’m sorry for the confusion…