ipfs / js-kubo-rpc-client

A client library for the Kubo RPC API
https://www.npmjs.com/package/kubo-rpc-client
Other
31 stars 7 forks source link

bug: HTTPError: unrecognized key type: Ed25519 #143

Closed SgtPooki closed 1 year ago

SgtPooki commented 1 year ago

Related to task being tracked in https://github.com/ipfs/js-kubo-rpc-client/issues/56: https://github.com/ipfs/js-kubo-rpc-client/issues/144

Note that I am getting this error as i'm trying to migrate webui to kubo-rpc-client

I have almost everything working, but when I run e2e tests, I'm getting the following failures in the ipns.test.js:

  1) explore.test.js:20:3 › Explore screen › should open arbitrary CID =============================

    Test timeout of 30000ms exceeded.

    page.waitForSelector: Target closed
    =========================== logs ===========================
    waiting for locator('text=Raw Block') to be visible
    ============================================================

      30 |     // await page.waitForSelector(`a[href="#/explore/${cid}"]`)
      31 |     // expect node type
    > 32 |     await page.waitForSelector('text=Raw Block')
         |                ^
      33 |     // expect cid details
      34 |     await page.waitForSelector('text=base32 - cidv1 - raw - sha2-256~256~46532C71D1B730E168548410DDBB4186A2C3C0659E915B19D47F373EC6C5174A')
      35 |   })

        at file:///Users/sgtpooki/code/work/protocol.ai/ipfs/webui/test/e2e/explore.test.js:32:16

    Pending operations:
      - page.waitForSelector at test/e2e/explore.test.js:32:16

  2) ipns.test.js:34:5 › IPNS publishing › Settings screen › should support adding new keys ========

    Test timeout of 30000ms exceeded.

    page.waitForSelector: Target closed
    =========================== logs ===========================
    waiting for locator('text=pet-name-e2e-ipns-test-1675975764917') to be visible
    ============================================================

      133 | async function waitForIPNSKeyList (ipfs, specificKey, page) {
      134 |   await page.waitForSelector('text=IPNS Publishing Keys')
    > 135 |   if (specificKey) await page.waitForSelector(`text=${specificKey}`)
          |                               ^
      136 |   for (const { id, name } of await ipfs.key.list()) {
      137 |     if (name.startsWith('rm-key-test-')) continue // avoid race with removal tests
      138 |     await page.waitForSelector(`text=${id}`)

        at waitForIPNSKeyList (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/webui/test/e2e/ipns.test.js:135:31)
        at file:///Users/sgtpooki/code/work/protocol.ai/ipfs/webui/test/e2e/ipns.test.js:49:7

    Pending operations:
      - page.waitForSelector at test/e2e/ipns.test.js:135:31

  3) ipns.test.js:52:5 › IPNS publishing › Settings screen › should support removing keys ==========

    HTTPError: unrecognized key type: Ed25519

      53 |       // create key that we want to remove
      54 |       const rmKeyName = 'rm-key-test-' + new Date().getTime()
    > 55 |       const { id } = await ipfs.key.gen(rmKeyName)
         |                      ^
      56 |       await page.reload()
      57 |       // remove key via UI on Settings page
      58 |       await page.waitForSelector(`text=${rmKeyName}`)

        at Object.errorHandler [as handleError] (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/webui/node_modules/kubo-rpc-client/src/lib/core.js:106:15)
        at Client.fetch (/Users/sgtpooki/code/work/protocol.ai/ipfs/webui/node_modules/kubo-rpc-client/node_modules/ipfs-utils/src/http.js:161:9)
        at Object.gen (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/webui/node_modules/kubo-rpc-client/src/key/gen.js:15:17)
        at file:///Users/sgtpooki/code/work/protocol.ai/ipfs/webui/test/e2e/ipns.test.js:55:22

  4) ipns.test.js:85:5 › IPNS publishing › Files screen › should have functional "Publish to IPNS" context action

    HTTPError: unrecognized key type: Ed25519

      75 |       keyName = 'pet-name-e2e-ipns-test-' + new Date().getTime()
      76 |       ipfs = kuboRpcModule.create(process.env.IPFS_RPC_ADDR)
    > 77 |       await ipfs.key.gen(keyName)
         |       ^
      78 |       await page.goto('/#/files')
      79 |       await page.reload()
      80 |     })

        at Object.errorHandler [as handleError] (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/webui/node_modules/kubo-rpc-client/src/lib/core.js:106:15)
        at Client.fetch (/Users/sgtpooki/code/work/protocol.ai/ipfs/webui/node_modules/kubo-rpc-client/node_modules/ipfs-utils/src/http.js:161:9)
        at Object.gen (file:///Users/sgtpooki/code/work/protocol.ai/ipfs/webui/node_modules/kubo-rpc-client/src/key/gen.js:15:17)
        at file:///Users/sgtpooki/code/work/protocol.ai/ipfs/webui/test/e2e/ipns.test.js:77:7

  4 failed
    explore.test.js:20:3 › Explore screen › should open arbitrary CID ==============================
    ipns.test.js:34:5 › IPNS publishing › Settings screen › should support adding new keys =========
    ipns.test.js:52:5 › IPNS publishing › Settings screen › should support removing keys ===========
    ipns.test.js:85:5 › IPNS publishing › Files screen › should have functional "Publish to IPNS" context action
SgtPooki commented 1 year ago

all tests are successful when using the proper casing:

> cross-env REACT_APP_ENV=test npx playwright test -c ./test/e2e "test/e2e/ipns.test.js"

Running 4 tests using 4 workers

[WebServer] (node:55312) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
  ✓  1 ipns.test.js:85:5 › IPNS publishing › Files screen › should have functional "Publish to IPNS" context action (3.7s)
  ✓  2 ipns.test.js:52:5 › IPNS publishing › Settings screen › should support removing keys (3.5s)
  ✓  3 ipns.test.js:34:5 › IPNS publishing › Settings screen › should support adding new keys (3.2s)
  ✓  4 ipns.test.js:29:5 › IPNS publishing › Settings screen › should list IPNS keys (2.7s)
name:  pet-name-e2e-ipns-test-1675981078960
options:  { type: 'ed25519' }
name:  rm-key-test-1675981079455
options:  { type: 'ed25519' }