nodebox-runtime icon indicating copy to clipboard operation
nodebox-runtime copied to clipboard

Seems to be broken

Open robtweed opened this issue 1 year ago • 5 comments

I've come back to Nodebox after some months, only to find that my previously working examples no longer work. The odd thing is that your online version here works:

https://codesandbox.io/p/devbox/priceless-bash-nlrrz4

I've stripped back my standalone vanilla JS version to this - based on the example from your version above:

(async () => {
  const {Nodebox} = await import('https://unpkg.com/@codesandbox/[email protected]/build/index.mjs');
  const emulator = new Nodebox({
    iframe: document.getElementById('preview'),
  });
  await emulator.connect();
  await emulator.fs.init({
    'package.json': JSON.stringify({
      name: 'my-app',
      dependencies: {
        express: "4.18.2"
      }
    }),
    'index.js': `const express = require('express');
const app = express();
const port = 3000;

app.get('/', (req, res) => {
  res.send('Hello world')
});

app.listen(port, () => {
  console.log(\`Example app listening on port \${port}\`)
});`
  });

const shell = emulator.shell.create();
const {id} = await shell.runCommand('node', ['index.js']);
const { url } = await emulator.preview.getByShellId(id);
console.log(url);

})();

When I try to connect using the URL shown in the console, it hangs and then I'm told it can't connect.

Could not connect to "nu13cex-3000.nodebox.codesandbox.io"
This server couldn't be reached. Make sure the node script is running and a server is started on port: "3000"

I see the following errors in the console:

https://nu13cex-3000.nodebox.codesandbox.io
__csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'MessagePort': A ReadableStream could not be cloned because it was not transferred.
    at _0x2e1433 (https://nu13cex-3000.nodebox.codesandbox.io/__csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105:13782)
_0x2e1433 @ __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105
await in _0x2e1433 (async)
_0x63346a @ __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105
_0x3ea396 @ __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105
(anonymous) @ __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105
The FetchEvent for "https://nu13cex-3000.nodebox.codesandbox.io/cdn-cgi/rum?" resulted in a network error response: the promise was rejected.
Promise.then (async)
(anonymous) @ __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105
__csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105 Uncaught (in promise) Error: Failed to handle POST https://nu13cex-3000.nodebox.codesandbox.io/cdn-cgi/rum? request: no response received from the BroadcastChannel within timeout. There's likely an issue with the bridge/worker communication.
    at __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105:15526
(anonymous) @ __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105
setTimeout (async)
_0x63346a @ __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105
_0x3ea396 @ __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105
(anonymous) @ __csb_sw.at3powcctjnrkzffq3qyf5kkzqljh91.js:105
v84a3a4012de94ce1a686ba8c167c359c1696973893317:1     POST https://nu13cex-3000.nodebox.codesandbox.io/cdn-cgi/rum? net::ERR_FAILED

It would be good to get it working again - any ideas?

Many thanks

robtweed avatar Nov 23 '23 17:11 robtweed

Seems like an issue with the network connection or cloudflare?

Works fine for me right now

DeMoorJasper avatar Nov 23 '23 18:11 DeMoorJasper

Unfortunately it doesn't work for me. My network connections are fine for everything else I do. Any suggestions for things that I can check/debug would be appreciated.

robtweed avatar Nov 24 '23 19:11 robtweed

Maybe a different browser or an incognito tab (no extensions)?

DeMoorJasper avatar Nov 24 '23 21:11 DeMoorJasper

Maybe a different browser or an incognito tab (no extensions)?

Tried Chrome and Firefox and incognito - no change

robtweed avatar Nov 24 '23 21:11 robtweed

Maybe a different browser or an incognito tab (no extensions)?

Tried Chrome and Firefox and incognito - no change

Tried on several different machines too

robtweed avatar Nov 24 '23 22:11 robtweed