-
Notifications
You must be signed in to change notification settings - Fork 977
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
Use bgipfs for upload #1039
Use bgipfs for upload #1039
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great Adam!! was just testing and while running yarn ipfs
I got the below error:
ipfs error
6% ❯ yarn ipfs
▲ Next.js 14.2.11
Creating an optimized production build ...
🌼 daisyUI 4.12.10
├─ ✔︎ 2 themes added https://daisyui.com/docs/themes
╰─ ❤︎ Support daisyUI project: https://opencollective.com/daisyui
✓ Compiled successfully
✓ Linting and checking validity of types
✓ Collecting page data
Generating static pages (0/8) [= ](node:6527) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:6534) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:6536) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:6535) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:6537) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:6533) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
✓ Generating static pages (8/8)
✓ Collecting build traces
Finalizing page optimization ..(node:6609) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
✓ Finalizing page optimization
Route (app) Size First Load JS
┌ ○ / 1.65 kB 432 kB
├ ○ /_not-found 879 B 89.7 kB
├ ○ /blockexplorer 1.4 kB 435 kB
├ ● /blockexplorer/address/[address] 235 B 434 kB
├ └ /blockexplorer/address/0x0000000000000000000000000000000000000000
├ ● /blockexplorer/transaction/[txHash] 1.42 kB 432 kB
├ └ /blockexplorer/transaction/0x0000000000000000000000000000000000000000
└ ○ /debug 7.35 kB 438 kB
+ First Load JS shared by all 88.8 kB
├ chunks/7023-38a60bcaec288bbe.js 31.9 kB
├ chunks/fd9d1056-805ccda7fca25131.js 53.6 kB
└ other shared chunks (total) 3.32 kB
○ (Static) prerendered as static content
● (SSG) prerendered as static HTML (uses getStaticProps)
IPFS add error: {
error: HTTPError: Request Entity Too Large
FUNCTION_PAYLOAD_TOO_LARGE
bom1::vhn88-1737877490716-8ee1864a251b
at Object.errorHandler [as handleError] (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/kubo-rpc-client/dist/src/lib/core.js:81:17)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Client.fetch (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/kubo-rpc-client/dist/src/lib/http.js:80:21)
at async KuboRPCClient.addAll (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/kubo-rpc-client/dist/src/add-all.js:21:25)
at async Object.directory (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/ipfs-uploader/dist/NodeUploader.js:90:42)
at async UploadCommand.run (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/bgipfs/dist/commands/upload/index.js:50:19)
at async UploadCommand._run (/Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/@oclif/core/lib/command.js:312:22)
at async Config.runCommand (/Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/@oclif/core/lib/config/config.js:435:25)
at async run (/Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/@oclif/core/lib/main.js:96:16)
at async file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/bgipfs/bin/run.js:5:1 {
response: Response {
status: 413,
statusText: 'Request Entity Too Large',
headers: Headers {
'cache-control': 'public, max-age=0, must-revalidate',
'content-length': '93',
'content-type': 'text/plain; charset=utf-8',
date: 'Sun, 26 Jan 2025 07:44:52 GMT',
server: 'Vercel',
'strict-transport-security': 'max-age=63072000',
'x-matched-path': '/api/ipfs-proxy/add',
'x-vercel-error': 'FUNCTION_PAYLOAD_TOO_LARGE',
'x-vercel-id': 'bom1::vhn88-1737877490716-8ee1864a251b'
},
body: ReadableStream { locked: true, state: 'closed', supportsBYOB: true },
bodyUsed: true,
ok: false,
redirected: false,
type: 'basic',
url: 'https://www.bgipfs.com/api/ipfs-proxy/add?stream-channels=true&wrap-with-directory=true&cid-version=1&progress=false'
}
},
message: 'Request Entity Too Large\n' +
'\n' +
'FUNCTION_PAYLOAD_TOO_LARGE\n' +
'\n' +
'bom1::vhn88-1737877490716-8ee1864a251b\n',
stack: 'HTTPError: Request Entity Too Large\n' +
'\n' +
'FUNCTION_PAYLOAD_TOO_LARGE\n' +
'\n' +
'bom1::vhn88-1737877490716-8ee1864a251b\n' +
'\n' +
' at Object.errorHandler [as handleError] (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/kubo-rpc-client/dist/src/lib/core.js:81:17)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
' at async Client.fetch (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/kubo-rpc-client/dist/src/lib/http.js:80:21)\n' +
' at async KuboRPCClient.addAll (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/kubo-rpc-client/dist/src/add-all.js:21:25)\n' +
' at async Object.directory (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/ipfs-uploader/dist/NodeUploader.js:90:42)\n' +
' at async UploadCommand.run (file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/bgipfs/dist/commands/upload/index.js:50:19)\n' +
' at async UploadCommand._run (/Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/@oclif/core/lib/command.js:312:22)\n' +
' at async Config.runCommand (/Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/@oclif/core/lib/config/config.js:435:25)\n' +
' at async run (/Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/@oclif/core/lib/main.js:96:16)\n' +
' at async file:///Users/shivbhonde/Desktop/github/scaffold-eth-2/packages/nextjs/node_modules/bgipfs/bin/run.js:5:1'
}
{
success: false,
cid: '',
error: 'Request Entity Too Large\n' +
'\n' +
'FUNCTION_PAYLOAD_TOO_LARGE\n' +
'\n' +
'bom1::vhn88-1737877490716-8ee1864a251b\n'
}
› Error: Upload failed: Upload failed
thanks @technophile-04! that's hitting a vercel function size limit, pushed a new approach which is using a cf worker |
Everything works great! Amazing work @azf20 !!! This is a lot faster than my code and it is cleaner as well! Here is the link to my app deployed with Adam's code: https://bafybeiduwahy6nmpkpvcebtctyplxmdgjvlrpwkcnrzi6zqaizse64muna.ipfs.gateway.bgipfs.com/ And here it is after adding it to my ens records: https://pallas-athena.eth.limo/ And it just works! |
THanks for the updates!! Yes works great now!! Can you run Also a question, is there a way we could make this just on command? Instead of it developer needing to run two separate commands? Like just Maybe we just un-gitignore the Small improvement nitpicks: While logging the link from bigipfs CLI can we log the whole link in the end? So that the developer doesn't need to construct the whole link himself manually? Another nitpick maybe we could handle it in future not at all necessary now: Unfurl are not resolving: App link: https://bafybeihijk22a4rnuxrv26ulacy3r3qzkjcbnt25atg7aqnlwqmyddblk4.ipfs.gateway.bgipfs.com/ |
OK great! Been making some changes to the underlying infrastructure so let's coordinate when this rolls out! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @azf20! This is really awesome 🔥🙏
I hate to be the "Windows guy" here... tried to run yarn install
and is throwing some errors :
Error on Git Bash when trying to `yarn install`
➤ YN0001: │ Error: ENOENT: no such file or directory, open
at Object.open (node:fs:565:11)
at Object.writeFile (node:fs:2309:6)
at node:internal/util:442:7
at new Promise (<anonymous>)
at Object.writeFile (node:internal/util:428:12)
at xze (E:\GitHub\scaffold-eth-2\.yarn\releases\yarn-3.2.3.cjs:236:193779)
at async Promise.all (index 0)
at async UL (E:\GitHub\scaffold-eth-2\.yarn\releases\yarn-3.2.3.cjs:236:1927
49)
at async Gze (E:\GitHub\scaffold-eth-2\.yarn\releases\yarn-3.2.3.cjs:710:128
75)
at async Oze (E:\GitHub\scaffold-eth-2\.yarn\releases\yarn-3.2.3.cjs:710:118
46)
➤ YN0000: └ Completed in 30s 834ms
➤ YN0000: Failed with errors in 38s 447ms
If I try to install bgipfs
package manually, I get these error logs:
2025-02-02T18_17_04_844Z-debug-0.log
When I use WSL on my Windows machine, yarn install
+ yarn ipfs
are working out of the box 👌:
✓ Configuration file initialized successfully.
✓ File uploaded. CID: bafybeidxejqgov2pso47erm4uzjxa2ddo2jao7ge2ews22mvwdi5m2jepi
🚀 Upload complete! Your site is now available at: https://gateway.bgipfs.com/ipfs/${cid}
Just as nitpicks:
- cid is not getting replaced (maybe is a WSL issue)
- The gateway url doesn't seem to work when I try to open it on chrome/brave
hey thanks so much @Pabl0cks! Good catch, the gateway url hadn't been updated, and it was just printing {cid} which I agree is less friendly than it might be - pushed a fix for both of those things. I'm not sure what is required for better Windows support |
I believe that we should focus only on WSL for windows support as everyone is moving away from git bash to WSL. |
I'm not against this! Seems like a pretty common practice and will save us from a lot of trouble. We'd just to state it clearly in the Docs. Let's see what others think too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm! Thanks @azf20! Just requested a small changes at https://github.com/scaffold-eth/scaffold-eth-2/pull/1039/files#r1944592425 but other than that everything looks great!
I'm not against this! Seems like a pretty common practice and will save us from a lot of trouble. We'd just to state it clearly in the Docs.
Yup I think mentioning in docs should be sufficient 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great for me too!
I'm not against this! Seems like a pretty common practice and will save us from a lot of trouble. We'd just to state it clearly in the Docs.
Agree!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok this is ready to go! Tested it on fresh clean install with the branch works great too, also tested with .env.local
and it picks correct env variables too 🙌 So yeah we just need to push the red button to launch this 🙌
I was trying to compare the install times of this branch and main branch and its 2-3 sec difference with yarn.lock
present :
test 1:

test 2:

Let's wait until @Pabl0cks test it again with Windows WSL....and maybe add the WSL requirement to the README? |
For WSL, it works great. I tried it again on my desktop, which didn't have WSL, and it worked nicely. This has been lingering in the back of my mind for a while. I'm afraid of "blocking" some Windows users from SE-2, as their yarn install would fail. I'm still hesitant to force them to fully commit to WSL, even though I agree it’s much handier for using some of the popular tools and technologies (e.g., Foundry, Eliza). I've been testing and found that if I install the GPT is suggesting me that probably the files section of bgipfs
Could this make sense @azf20? What would be the easier way to try it out? A bit npm-newbie here, but happy to help 🙏 Even if the origin is not exactly that one, it may be some other parameter of the package.json it seems. |
thanks so much for taking a look @Pabl0cks! I made changes and pushed with the latest version of bgipfs, hope that works on windows now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was still failing with the latest changes, but today @technophile-04 helped me debug the problem and we (he 😅) found out the reason!
bgipfs requires node version >20.18.1 and i was using 20.11
Updated my node version and is working nicely, both yarn install
& yarn ipfs
. Awesome job everyone! Approving & merging this
Great!
Then we need to update the project dependencies on the README / docs, right? |
Description
To upload a site to BuidlGuidl's IPFS node, in the nextjs package:
These commands wrap initialisation and upload commands from bgipfs. This uses a default proxy endpoint (no auth required at this time)