storacha-network / w3up

⁂ w3up protocol implementation
https://github.com/storacha-network/specs
Other
54 stars 19 forks source link

Error "Space has no name" loading proof #1175

Closed juliangruber closed 9 months ago

juliangruber commented 9 months ago

I am trying to follow https://web3.storage/docs/how-to/upload/ for setting up an agent with pkey and proof, to upload in a server environment where you can't do the email dance.

I'm getting this error:

Error: Space has no name, please pass a `name` option to specify it
    at Agent.importSpaceFromDelegation (file:///Users/julian/dev/filecoin-station/spark-api/spark-publish/node_modules/@web3-storage/access/dist/src/agent.js:308:19)
    at Client.addSpace (file:///Users/julian/dev/filecoin-station/spark-api/spark-publish/node_modules/@web3-storage/w3up-client/src/client.js:228:30)
    at ...

I'm initializing the space like this:

async function parseProof (data) {
  const blocks = []
  const reader = await CarReader.fromBytes(Buffer.from(data, 'base64'))
  for await (const block of reader.blocks()) {
    blocks.push(block)
  }
  return importDAG(blocks)
}

const principal = ed25519.Signer.parse(W3UP_AGENT_PRIVATE_KEY)
const web3Storage = await Client.create({ principal })
const proof = await parseProof(W3UP_AGENT_PROOF)
const space = await web3Storage.addSpace(proof) // <- throws

I have created the pkey and proof like this:

$ npx ucan-key ed --json
$ npx @web3-storage/w3cli delegation create did:key:...--can 'store/add' --can 'upload/add' | base64
travis commented 9 months ago

Thanks @juliangruber ! You've identified a bug we introduced late in the game - thanks! We need to confer as a team on how best to fix so it might take a couple days (especially on this holiday week) but you can track its progress here: https://github.com/web3-storage/w3up/pull/1177

juliangruber commented 9 months ago

I can confirm this all works, after manually upgrading the access dependency :) Thank you!