rrweb icon indicating copy to clipboard operation
rrweb copied to clipboard

rrweb for sandbox

Open AjkP opened this issue 7 years ago • 8 comments

As far as I understand rrweb is not available for sandbox environments. IMO this makes it really hard to adopt it and/or use it.

How would one make sure that rrweb is working before deploying it live to some website? This makes it really hard to develop and/or test any new changes one might want to make.

AjkP avatar Sep 30 '19 15:09 AjkP

Hi @AjkP, I think rrweb has no limitation on the recording side, could you tell me about what you mean sandbox?

Yuyz0112 avatar Oct 01 '19 02:10 Yuyz0112

My bad for the miscommunication. I meant on the replaying side. I cannot put up a replayer on a sandbox based on this issue https://github.com/rrweb-io/rrweb/issues/70. Without sandbox I feel like there's no way I could not deploy this for anything since I wouldn't be willing to test in prod.

AjkP avatar Oct 01 '19 02:10 AjkP

The sandbox is just used for the replayer iframe and it's an internal strategy which should affect your app.

For example, you can build a replayer UI like this:

<your-root>
  <any-custom-ui>
  </any-custom-ui>
  <replayer-root>
    <replayer-iframe /> <!- only this part is in a sandbox iframe ->
  </replayer-root>
</your-root>

Or maybe you can provide some code so I can help in making it work?

Yuyz0112 avatar Oct 01 '19 02:10 Yuyz0112

Or maybe you can provide some code so I can help in making it work?

I just tried to use the recording and replaying as a proof of concept as described in the guide:

const rrweb = require('rrweb');
let events = [];

function record() {
  rrweb.record({
    emit(event) {
      // push event into the events array
      events.push(event);
    },
  });
}

function replay() {
  const replayer = new rrweb.Replayer(events);
  replayer.play();
}

module.exports = {record, replay}

Then I call from the dev tools console, first module.record then module.replay. The module.replay gives me the blocked script execution error mentioned here which from my understanding on that thread is by design?

AjkP avatar Oct 01 '19 16:10 AjkP

Okay, I think the in-place replay is not a general testing method. Would you mind trying the REPL tool which seems more suitable for your use case.

Yuyz0112 avatar Oct 02 '19 06:10 Yuyz0112

Okay, I think the in-place replay is not a general testing method.

What's the best testing method? I'm really just trying to have a prototype working that does only the record and replay (to then decide if to invest more time in making it work nicely with backend support, etc).


The REPL tool also doesn't seem to work for me. Not sure if I'm doing anything bad. My node/npm versions:

➜  ~  node -v
v11.14.0
➜  ~  npm -v
6.7.0

AjkP avatar Oct 02 '19 17:10 AjkP

The REPL tool doesn't work for me either. The Documentation seems unclear about REPL because running npm run repl looks for a local script in package.json which doesn't exist.

So, I went inside node_modules/rrweb and tried running the command there (because rrweb's package.json contains the repl npm script) and I got:

npm run repl

> [email protected] repl /home/test/Desktop/Test/Projects/Automation/repl/node_modules/rrweb
> npm run bundle:browser && cross-env TS_NODE_CACHE=false TS_NODE_FILES=true ts-node scripts/repl.ts


> [email protected] bundle:browser /home/test/Desktop/Test/Projects/Automation/repl/node_modules/rrweb
> cross-env BROWSER_ONLY=true rollup --config

[!] Error: Could not resolve entry module (rollup.config.js).
Error: Could not resolve entry module (rollup.config.js).
    at error (/home/test/Desktop/Test/Projects/Automation/repl/node_modules/rrweb/node_modules/rollup/dist/shared/rollup.js:161:30)
    at resolveId.then.resolveIdResult (/home/test/Desktop/Test/Projects/Automation/repl/node_modules/rrweb/node_modules/rollup/dist/shared/rollup.js:17177:20)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)

My version details:

test@test:~$ node -v
v10.8.0
test@test:~$ npm -v
6.2.0
test@test:~$ 

AnkurThakur avatar May 01 '20 11:05 AnkurThakur