SuperblocksHQ/superblocks-lab

App view does not work in release mode (custom ORIGIN)

Closed this issue · 1 comments

Environment/Browser

Lab 1.4.2

Description

The Show Preview window contents load, but won't retrieve any value. Apparently, it is something to do with web3.

Steps to reproduce

Deployed using:
ORIGIN_DIST=lab-beta.[...] make dist_beta

On Browser or Ropsten network:

  1. Create new project from Hello World template
  2. Expand contracts/HelloWorld.sol
  3. Click Deploy
  4. Click Show Preview

Expected result

Expected Message and Block number fields to be present when running the Hello World app view.

Actual result

Empty Message and Block number when running Hello World app view (Show Preview). No errors logged to the browser console.

Questions and possible hints

  1. The same behavior happens when ORIGIN_DIST is misconfigured.
    Example:
ORIGIN_DIST=misconfigured-host.com make dist_beta && cd dist && python2 -m SimpleHTTPServer 3000
  1. Contract interaction is still working

  2. Further inspect ORIGIN for app view. See also Item 6.

"Trace down why the ORIGIN if statement is ignoring the message"

  1. When Ropsten network is selected and the Disable accounts Accounts are not injected into the dapp simulating when Metamask is not active. checkbox is selected, the Show Preview works.

  2. Double check: web3 postMessage proxy is not being used

"It is just using it's own web3 object in the iframe - no magic applied."

  1. Extended local testing mimicking a specific ORIGIN setup:
ORIGIN_DIST=lab-beta.[...] make dist_beta && cd dist && python2 -m SimpleHTTPServer 3000

Then edit /etc/hosts to point lab-beta and lab-dapp-beta to the local server (e.g. 127.0.0.1, then browser to lab-beta.[...]:3000).

Initial troubleshooting

Upon further inspection, it's been noticed that in ./src/components/superprovider/web3provider.js, event origin points to lab-dapp-beta while the expected ORIGIN is set to lab-beta. This results in an early exit (first return statement), causing the init data type message call to never be processed.

Solved in request #323