Closed santiq closed 1 year ago
When trying to use the psa/add endpoint
Error uploading file 0 HTTPError: Not Found at Object.errorHandler [as handleError] (/Users/xxx/xxx/metaplex/js/node_modules/ipfs-http-client/src/lib/core.js:100:15) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Client.fetch (/Users/xxx/xxx/metaplex/js/node_modules/ipfs-utils/src/http.js:145:9) at async addAll (/Users/xxx/xxx/metaplex/js/node_modules/ipfs-http-client/src/add-all.js:40:17) at async last (/Users/xxx/xxx/metaplex/js/node_modules/it-last/index.js:13:20) at async Object.add (/Users/xxx/xxx/metaplex/js/node_modules/ipfs-http-client/src/add.js:23:14) { response: Response { size: 0, timeout: 0, [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'https://api.pinata.cloud/psa/add?stream-channels=true&progress=false', status: 404, statusText: 'Not Found', headers: [Headers], counter: 0 } } }
My code:
const ipfs = create({ url: 'https://api.pinata.cloud/psa', headers: { "Authorization": `Bearer ${ipfsCredentials.accessToken}` } }); const uploadToIpfs = async source => { const { cid } = await ipfs.add(source).catch(); return cid; }; const mediaHash = await uploadToIpfs(globSource(image, { recursive: true })); log.debug('mediaHash:', mediaHash); const mediaUrl = `https://ipfs.io/ipfs/${mediaHash}`; log.debug('mediaUrl:', mediaUrl); await fetch("https://api.pinata.cloud/pinning/pinByHash", { headers: { "Authorization": `Bearer ${ipfsCredentials.accessToken}` }, method: 'POST', body: JSON.stringify({ hashToPin: mediaHash }) }); log.info('uploaded image for file:', image);
maybe related to #52
hello @santiq as mentioned by Matt this is not possible https://github.com/PinataCloud/Pinata-SDK/issues/52#issuecomment-867036544
When trying to use the psa/add endpoint
My code:
maybe related to #52