Picolab / pico-pods

Linking picos to Solid pods
0 stars 0 forks source link

@inrupt/solid-client Unknown Scheme Error When Storing Files #22

Open keylanjensen opened 4 months ago

keylanjensen commented 4 months ago

When a typescript file calls @inrupt/solid-client's functions for storing a file in a Pod server (overwriteFile() or saveFileInContainer()), the fetch fails with this error provided to engine output:

TypeError: fetch failed
    at node:internal/deps/undici/undici:12344:11
    at async overwriteFile (C:\Users\Keylan\Documents\CS480\practice_module\test_pico\updated_dependencies\pico-engine\node_modules\@inrupt\solid-client\dist\index.js:1912:22)
    at async Object.<anonymous> (C:\Users\Keylan\Documents\CS480\practice_module\test_pico\updated_dependencies\pico-engine\packages\pico-engine-core\dist\modules\pods.js:65:23)
    at async Object.body (C:\Users\Keylan\.pico-engine\rulesets\1.3.0\91\a3\91a3bc8ae015b6fe94bf6bdcadea9cf6b1f30ed7963e9e5446e8ae506208cb05.js:71:11) {
  cause: Error: unknown scheme
      at makeNetworkError (node:internal/deps/undici/undici:5585:35)
      at schemeFetch (node:internal/deps/undici/undici:10472:34)
      at node:internal/deps/undici/undici:10342:26
      at mainFetch (node:internal/deps/undici/undici:10361:11)
      at fetching (node:internal/deps/undici/undici:10309:7)
      at fetch (node:internal/deps/undici/undici:10173:20)
      at Object.fetch (node:internal/deps/undici/undici:12343:10)
      at fetch (node:internal/process/pre_execution:335:27)
      at writeFile (C:\Users\Keylan\Documents\CS480\practice_module\test_pico\updated_dependencies\pico-engine\node_modules\@inrupt\solid-client\dist\index.js:1990:73)
      at overwriteFile (C:\Users\Keylan\Documents\CS480\practice_module\test_pico\updated_dependencies\pico-engine\node_modules\@inrupt\solid-client\dist\index.js:1912:28)
}

This output is given in both the main and dependency-updates branches.

keylanjensen commented 4 months ago

This is taken from running npm ls buffer in the dependency-updates branch of the Pico engine.

$ npm ls buffer
pico-engine@ C:\Users\Keylan\Documents\CS480\practice_module\test_pico\updated_dependencies\pico-engine
├─┬ @inrupt/solid-client@2.0.0
│ ├── buffer@6.0.3
│ └─┬ jsonld-streaming-parser@3.3.0
│   ├─┬ @bergos/jsonparse@1.4.1
│   │ └── buffer@6.0.3 deduped
│   ├── buffer@6.0.3 deduped
│   └─┬ readable-stream@4.5.2
│     └── buffer@6.0.3 deduped
├─┬ abstract-level@1.0.4 extraneous
│ └── buffer@6.0.3 deduped
└─┬ level-transcoder@1.0.1 extraneous
  └── buffer@6.0.3 deduped

In the main branch, npm ls buffer returns:

$ npm ls buffer
pico-engine@ C:\Users\Keylan\Documents\CS480\practice_module\test_pico\pico-engine
├─┬ @inrupt/solid-client@2.0.0
│ ├── buffer@6.0.3
│ └─┬ jsonld-streaming-parser@3.3.0
│   ├─┬ @bergos/jsonparse@1.4.1
│   │ └── buffer@6.0.3 deduped
│   ├── buffer@6.0.3 deduped
│   └─┬ readable-stream@4.5.2
│     └── buffer@6.0.3 deduped
├─┬ abstract-leveldown@6.3.0 extraneous
│ └── buffer@5.7.1 extraneous
├─┬ deferred-leveldown@5.3.0 extraneous
│ ├─┬ abstract-leveldown@6.2.3 extraneous
│ │ └── buffer@5.7.1 deduped
│ └── buffer@5.7.1 extraneous
├─┬ level-codec@9.0.2 extraneous
│ └── buffer@5.7.1 extraneous
├─┬ leveldown@5.6.0 extraneous
│ ├─┬ abstract-leveldown@6.2.3 extraneous
│ │ └── buffer@5.7.1 deduped
│ └── buffer@5.7.1 extraneous
├─┬ memdown@5.1.0 extraneous
│ ├─┬ abstract-leveldown@6.2.3 extraneous
│ │ └── buffer@5.7.1 deduped
│ └── buffer@5.7.1 extraneous
└─┬ node-libs-browser@2.2.1 extraneous
  └── buffer@4.9.2 extraneous

When running npm run clean-setup in the main branch, it returns:

lerna info lifecycle pico-engine-core@1.3.0~prepublish: pico-engine-core@1.3.0

> pico-engine-core@1.3.0 prepublish C:\Users\Keylan\Documents\CS480\practice_module\test_pico\pico-engine\packages\pico-engine-core
> npm run build

../../node_modules/@inrupt/solid-client/dist/resource/file.d.ts(2,15): error TS2305: Module '"buffer"' has no exported member 'File'.
lerna info lifecycle pico-engine-core@1.3.0~prepublish: Failed to exec prepublish script
lerna ERR! lifecycle "prepublish" errored in "pico-engine-core", exiting 2

This issue is not seen when running npm run clean-setup in the dependency-updates branch.

farskipper commented 4 months ago

The dependency-updates updates a lot of things to be compatible with the latest node LTS, so I'd recommend developing on that instead of what's currently in main.

@b1conrad If you're ready, I'd recommend merging dependency-updates and releasing a 1.4.0. If there are any compatibility issues with existing deployments, they can adjust or lock to 1.3.x

farskipper commented 4 months ago

For the fetch failed unknown scheme issue, that's probably coming from how the solid-client is configured. At some point that library calls fetch(url, ...) and the url string does not start with a proper scheme i.e. https://, file:// etc.