Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Crashes on Ndb.FileSystem.getMetadata #326

Open
wesbos opened this issue Feb 12, 2021 · 4 comments
Open

Crashes on Ndb.FileSystem.getMetadata #326

wesbos opened this issue Feb 12, 2021 · 4 comments

Comments

@wesbos
Copy link

wesbos commented Feb 12, 2021

Steps to reproduce

Tell us about your environment:

  • ndb version: 1.1.5
  • Platform / OS version: Mac OS Catalina
  • Node.js version: 15.6.0

When running NDB on a basic Next.js project, it crashes.

package.json:

{
  "name": "ndb",
  "scripts": {
    "dev": "next"
  },
  "dependencies": {
    "next": "^10.0.6",
    "react": "^17.0.1",
    "react-dom": "^17.0.1"
  }
}

pages/index.js

const Page = () => <p>hi</p>
export default Page;

Then run ndb npm run dev in your console. As soon as you visit the site, Next.js builds that first page and the whole thing crashes:

 ⮀ ndb npm run dev

> dev
> next

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
event - compiled successfully
event - build page: /
wait  - compiling...
event - compiled successfully
/usr/local/lib/node_modules/ndb/services/ndd_service.js:21
  throw error;
  ^

Error: Error: not implemented
Error: not implemented
    at Ndb.FileSystem.getMetadata (https://domain/ndb.js:3:175663)
    at Persistence.FileSystemWorkspaceBinding.FileSystem.requestMetadata (https://domain/ndb.js:3:131825)
    at Workspace.UISourceCode.requestMetadata (https://domain/ndb.js:1:648280)
    at n (https://domain/ndb.js:3:141810)
    at https://domain/ndb.js:3:141759
    at Array.map (<anonymous>)
    at Persistence.Automapping._pullMetadatas (https://domain/ndb.js:3:141752)
    at Persistence.Automapping._createBinding (https://domain/ndb.js:3:141234)
    at Persistence.Automapping._computeNetworkStatus (https://domain/ndb.js:3:138667)
    at Persistence.Automapping._onUISourceCodeAdded (https://domain/ndb.js:3:137732)
    at Rpc.dispatchMessageLocally_ (/usr/local/lib/node_modules/ndb/node_modules/carlo/rpc/rpc.js:423:16)
    at Rpc.routeMessage_ (/usr/local/lib/node_modules/ndb/node_modules/carlo/rpc/rpc.js:371:12)
    at process.emit (node:events:379:20)
    at emit (node:internal/child_process:918:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
node:events:356
      throw er; // Unhandled 'error' event
      ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:329:5)
    at ChildProcess.target.send (node:internal/child_process:722:16)
    at Rpc.routeMessage_ (/usr/local/lib/node_modules/ndb/node_modules/carlo/rpc/rpc.js:379:9)
    at /usr/local/lib/node_modules/ndb/node_modules/carlo/lib/carlo.js:388:71
    at Page._onBindingCalled (/usr/local/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Page.js:548:56)
    at CDPSession.<anonymous> (/usr/local/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Page.js:136:54)
    at CDPSession.emit (node:events:379:20)
    at CDPSession._onMessage (/usr/local/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Connection.js:200:12)
    at Connection._onMessage (/usr/local/lib/node_modules/ndb/node_modules/puppeteer-core/lib/Connection.js:112:17)
    at PipeTransport._dispatch (/usr/local/lib/node_modules/ndb/node_modules/puppeteer-core/lib/PipeTransport.js:65:24)
Emitted 'error' event on ChildProcess instance at:
    at node:internal/child_process:726:35
    at processTicksAndRejections (node:internal/process/task_queues:76:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}

What is the expected result?

It doesn't crash

What happens instead?

It crashes

@jesstelford
Copy link

jesstelford commented Feb 26, 2021

I've noticed this same error occurs when running ndb ./node_modules/.bin/next dev, which removes npm as a candidate for the crash here.

I am seeing the crash with Chromium r624492, [email protected] on OSX, with node v12.20.1

Edit: Doing a bit of digging:

It looks like ndb uses carlo which has been unmaintained for over a year.

Carlo is a wrapper over puppeteer but since being unmaintained, puppeteer has moved on and is using a much more modern version of Chromium.

The dependency tree goes: [email protected] -> carlo@^0.9.46 -> puppeteer-core@~1.12.0 (which resolves to v1.12.2) > [email protected] appears to depend on chromium@624492

... Does any of this information help us at all? ¯\_(ツ)_/¯ probably not

Edit 2: There does appear to be a NDB_CARL_ARGS env var which can be set to override any of the carlo.launch() parameters. In particular, the executablePath one might be of interest:

NDB_CARLO_ARGS='{"executablePath":"/foo/bar"}' ndb ./node_modules/.bin/next dev

I'm thinking perhaps the revision that [email protected] resolves to (chromium@624487) could be forced or manually downloaded, and run ndb against that?

My reasoning being that Puppeteer call out in their docs very explicitly that a single version of puppeteer is only guaranteed to work with a specific revision of chromium. And perhaps the ~ in the puppeteer-core semver is causing issues with what carlo expects? But really, I'm just clutching at straws 😅

@tomenden
Copy link

Was there any solution/workaround for this? I am getting this error all the time :(

@jesstelford
Copy link

Try this as a workaround. Note it only works for [email protected]:

NDB_CARLO_ARGS='{"channel":["r624487"]}' ndb <your-args-here>

@samdenty
Copy link

samdenty commented Nov 17, 2022

getting this error, the above not working as a workaround

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants