question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

upload folder fialed

See original GitHub issue

my program

const fs = require('fs');
const path = require('path');
const pinataSDK = require('@pinata/sdk');
const pinata = pinataSDK(API Key,API Secret);
async  function main(){
    const imgPath = path.join(__dirname,'..','img')
    const files = fs.readdirSync(imgPath)
    for(var i = 0;i< files.length;i++){
        console.log('Pinning to pinata ....')
        const readableStreamForFile = fs.createReadStream(imgPath+`/${files[i]}`);
        let result = await pinata.pinFileToIPFS(readableStreamForFile);
        hashes.push(result.IpfsHash);
    }
}

main();

I get this error when compiling

TypeError: pinataSDK is not a function at Object.<anonymous> (/Users/steven/Documents/Node/src/pin-to-ipfs/scripts/upload.js:4:16) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
cxqicommented, Nov 3, 2022

While @rommel-pinata looks into this, can you please try downgrading to this version? https://www.npmjs.com/package/@pinata/sdk/v/1.2.1

npm i @pinata/sdk@1.2.1 Thanks a lot, the problem is solved

0reactions
cxqicommented, Nov 3, 2022

hey @rommel-pinata the version of node I use and the sdk of pinata

  • node version v12.18.3
  • npm version v6.14.6
  • pinata sdk @pinata/sdk@2.0.0-beta.0
Read more comments on GitHub >

github_iconTop Results From Across the Web

12 Easy Ways to Fix Google Drive Upload Failed Issue in 2021
This article offers you 12 easy and useful ways to solve upload failure on Google Drive and introduces you an efficient method to...
Read more >
"Upload failed" for large folders using Google drive in Chrome ...
"Upload failed" for large folders using Google drive in Chrome browser. I am trying to upload a folder with a lot of subfolders...
Read more >
Fix Box Upload Failed for Free | 14 Ways + 2 Tips - CBackup
14 Quick Solutions to Box Upload Failed · Solution 1. Check Box Upload Limit First · Solution 2. Clear Browser's Cache · Solution...
Read more >
Google Drive Failed to Upload – What You Can Do - Alphr
Uploading is much more demanding on your network than downloading, and sometimes trying to upload a massive folder all at once can cause...
Read more >
How to Solve File Upload Errors in Google Drive - MakeUseOf
To do this, click the Backup and Sync icon in your system tray. Click the Settings icon (three vertical dots) and click Quit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found