storacha/w3cli

`w3 space usage` shows uncaught error `Error: no proofs available for resource did:key:z6MkkzxLtWpqXQPPXLEjD2M2gWJZikcpCbdk4HBf7tj7K59j and ability usage/report`

Opened this issue · 1 comments

⚡ w3 usage report                       
 Account: did:mailto:dag.house:bengo
Provider: did:web:web3.storage
   Space: did:key:z6MktxMvmk3ii638jWcuqzUP3o2A4x2cFnqh9PVKzsaofN1c
    Size: 0

file:///Users/bengo/.nvm/versions/node/v20.11.0/lib/node_modules/@web3-storage/w3cli/node_modules/@web3-storage/access/dist/src/agent.js:489
throw new Error(no proofs available for resource ${space} and ability ${cap.can});
^

Error: no proofs available for resource did:key:z6MkkzxLtWpqXQPPXLEjD2M2gWJZikcpCbdk4HBf7tj7K59j and ability usage/report
at Agent.invoke (file:///Users/bengo/.nvm/versions/node/v20.11.0/lib/node_modules/@web3-storage/w3cli/node_modules/@web3-storage/access/dist/src/agent.js:489:19)
at Agent.invokeAndExecute (file:///Users/bengo/.nvm/versions/node/v20.11.0/lib/node_modules/@web3-storage/w3cli/node_modules/@web3-storage/access/dist/src/agent.js:424:32)
at report (file:///Users/bengo/.nvm/versions/node/v20.11.0/lib/node_modules/@web3-storage/w3cli/node_modules/@web3-storage/w3up-client/src/capability/usage.js:38:31)
at UsageClient.report (file:///Users/bengo/.nvm/versions/node/v20.11.0/lib/node_modules/@web3-storage/w3cli/node_modules/@web3-storage/w3up-client/src/capability/usage.js:16:23)
at getSpaceUsageReports (file:///Users/bengo/.nvm/versions/node/v20.11.0/lib/node_modules/@web3-storage/w3cli/index.js:631:54)
at getSpaceUsageReports.next ()
at usageReport (file:///Users/bengo/.nvm/versions/node/v20.11.0/lib/node_modules/@web3-storage/w3cli/index.js:591:53)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.11.0

Context

  • in my account there are proofs for many spaces, including old ones from before we had usage/report
  • some of those proofs cause spaces to be checked for usage, but because we don't have authorizations for usage/report for those space, the server rejects the usage/report invocation
  • the w3cli is not expecting this error, so it goes uncaught and fails

What should it do?

  • At the very least, catch this error and give a better explanation to the user about what happened
  • maybe also continue on getting usage/report for other spaces that dont error, and only show the errors at the end with a partial usage report

discovered while retesting storacha/w3up#1182