Skip to content

Feedback for “How to upload data using web3.storage” #74

@Nobin-pikky

Description

@Nobin-pikky

Im not able to upload files

`const { create } = await import('@web3-storage/w3up-client');
const { filesFromPaths } = await import('files-from-path')
const {Signer}=await import('@ucanto/principal/ed25519')
const { StoreMemory }=await import('@web3-storage/w3up-client/stores')

            const principal = Signer.parse(process.env.WEB3)
            const store = new StoreMemory()
            const client = await create({ principal, store })
            // Add proof that this agent has been delegated capabilities on the space
            const proof = await IPFS.prototype.parseProof(process.env.PROOF)
            const space = await client.addSpace(proof)
            console.log("space: ",space)
            await client.setCurrentSpace(space.did())
            


            const tempPath = path.join(__dirname, "files",id);
            
            const files = await filesFromPaths(tempPath)

            const directoryCid = await client.uploadDirectory(files)
            console.log("\nHello\n")
            console.log("cid: ",directoryCid)`
            
            as insisted in the documentation but I get this error
            
            {
name: 'Unauthorized',
stack: 'Unauthorized: Claim {"can":"store/add"} is not authorized\n' +
  '  - Capability {"can":"store/add","with":"did:key:z6MkqSMb1mXqq6eXZuFGU8H6pt4auXRaodSreJ3JTbioARc1","nb":{"link":{"/":"bagbaiera7xgmhktzfka6jzg3yjhafzqcikxh65sutsiyh7t5lkeimnpusexa"},"size":1985203}} is not authorized because:\n' +
  "    - Capability can not be (self) issued by 'did:key:z6MkfRiHsNnRg81m88rW2z4ig83zLY9ftARRh1Vnr41NNyic'\n" +
  '    - Delegated capability not found\n' +
  '    at claim (/node_modules/@ucanto/validator/src/lib.js:308:12)\n' +
  '    at runMicrotasks (<anonymous>)\n' +
  '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
  '    at Object.add (/node_modules/@ucanto/server/src/handler.js:61:27)\n' +
  '    at invoke2 (/node_modules/@ucanto/server/src/server.js:145:23)\n' +
  '    at async Promise.all (index 0)\n' +
  '    at execute (/node_modules/@ucanto/server/src/server.js:104:5)\n' +
  '    at ucanInvocationRouter (/upload-api/functions/ucan-invocation-router.js:260:20)\n' +
  '    at Runtime.handler (/node_modules/src/awslambda.ts:332:1)',
message: 'Claim {"can":"store/add"} is not authorized\n' +
  '  - Capability {"can":"store/add","with":"did:key:z6MkqSMb1mXqq6eXZuFGU8H6pt4auXRaodSreJ3JTbioARc1","nb":{"link":{"/":"bagbaiera7xgmhktzfka6jzg3yjhafzqcikxh65sutsiyh7t5lkeimnpusexa"},"size":1985203}} is not authorized because:\n' +
  "    - Capability can not be (self) issued by 'did:key:z6MkfRiHsNnRg81m88rW2z4ig83zLY9ftARRh1Vnr41NNyic'\n" +
  '    - Delegated capability not found'
  
  I used w3 delegation create did:key:z6MkqS... --can 'store/add' | base64 to create the Proof 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions