Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Nobin-pikky opened this issue Jan 18, 2024 · 3 comments
Open

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

Nobin-pikky opened this issue Jan 18, 2024 · 3 comments

Comments

@Nobin-pikky
Copy link

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 
@heyjay44
Copy link
Contributor

@Nobin-pikky which version of node are you using?

@Nobin-pikky
Copy link
Author

v18.19.0

@kairoses
Copy link

kairoses commented Mar 8, 2025

@Nobin-pikky This seems to happen due to the authorization expiring. I'm looking for a way to automate the renewal but haven't found it yet. Were you able to get it sorted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants